warp.quaternion#

warp.quaternion(dtype: Float = ...) → Quaternion[Float]#
  • Kernel: true
  • Python: false
  • Differentiable: true

Construct a zero-initialized quaternion.

Quaternions store their components in (x, y, z, w) order, where x, y, and z form the vector (imaginary) part and w is the scalar (real) part. For the identity rotation, use quat_identity().

Parameters:

dtype – Scalar type of the components. Defaults to float32.

Returns:

The quaternion (0, 0, 0, 0).

warp.quaternion(
x: Float,
y: Float,
z: Float,
w: Float,
dtype: Float = ...,
) → Quaternion[Float]
  • Kernel: true
  • Python: false
  • Differentiable: true

Construct a quaternion from its components.

All arguments must have the same scalar type, which must match dtype when it is given.

Parameters:
  • x – x component of the vector (imaginary) part.

  • y – y component of the vector (imaginary) part.

  • z – z component of the vector (imaginary) part.

  • w – Scalar (real) part.

  • dtype – Scalar type of the components, inferred from the other arguments when omitted.

Returns:

The quaternion (x, y, z, w).

warp.quaternion(
ijk: Vector[Float, Literal[3]],
real: Float,
dtype: Float = ...,
) → Quaternion[Float]
  • Kernel: true
  • Python: false
  • Differentiable: true

Construct a quaternion from its vector and scalar parts.

All arguments must have the same scalar type, which must match dtype when it is given.

Parameters:
  • ijk – Vector (imaginary) part, stored as the x, y, and z components.

  • real – Scalar (real) part, stored as the w component.

  • dtype – Scalar type of the components, inferred from the other arguments when omitted.

Returns:

The quaternion (ijk[0], ijk[1], ijk[2], real).

warp.quaternion(
quat: Quaternion[Float],
dtype: Float = ...,
) → Quaternion[Float]
  • Kernel: true
  • Python: false
  • Differentiable: true

Construct a copy of a quaternion, optionally converting its scalar type.

Parameters:
  • quat – Quaternion to copy.

  • dtype – Scalar type of the result. Defaults to the scalar type of quat.

Returns:

A quaternion with the components of quat, converted to dtype.