newton.Axis#
- class newton.Axis(value)[source]#
Bases:
IntEnumEnumeration of axes in 3D space.
- classmethod from_any(value)#
Convert a value of various types to an Axis enum member.
- Parameters:
value (Axis | Literal['X', 'Y', 'Z'] | ~typing.Literal[0, 1, 2] | int | str) – The value to convert. Can be an Axis, str, or int-like.
- Returns:
The corresponding Axis enum member.
- Raises:
TypeError – If the value cannot be converted to an Axis.
ValueError – If the string or integer does not correspond to a valid Axis.
- Return type:
- classmethod from_string(axis_str)#
Convert a string representation of an axis (“x”, “y”, or “z”) to the corresponding Axis enum member.
- Parameters:
axis_str (str) – The axis as a string. Should be “x”, “y”, or “z” (case-insensitive).
- Returns:
The corresponding Axis enum member.
- Raises:
ValueError – If the input string does not correspond to a valid axis.
- Return type:
- quat_between_axes(other)#
Return the quaternion between two axes.
- to_vec3()#
Return the axis as a warp.vec3 unit vector.
- Returns:
The unit vector corresponding to the axis.
- Return type:
- to_vector()#
Return the axis as a 3D unit vector.
- X = 0#
X-axis.
- Y = 1#
Y-axis.
- Z = 2#
Z-axis.