Math & Geometry Types
Vec3
Quat
- class dazpy.Quat(x, y, z, w)[source]
Bases:
objectUnit quaternion representing a 3D rotation.
Stored as
(x, y, z, w)— imaginary components first, scalar last. This matches the dict format returned by the dazpy API (DazNode.rotation,DazBone.local_rotation).All methods return new
Quatinstances. The object is immutable.- Parameters:
- classmethod from_euler(x, y, z, order='XYZ')[source]
Create from Euler angles in degrees using intrinsic rotations.
Intrinsic means each rotation is applied in the frame left by the previous rotation — the same convention DAZ Studio uses for bone rotation channels.
- Parameters:
x (float) – Rotation around the X axis in degrees.
y (float) – Rotation around the Y axis in degrees.
z (float) – Rotation around the Z axis in degrees.
order (str) – Application order — one of
XYZ,XZY,YXZ,YZX,ZXY,ZYX. Matchesrotation_order.
- Returns:
A unit quaternion.
- Return type:
- to_euler(order='XYZ')[source]
Extract Euler angles in degrees.
The inverse of
from_euler()for the same order. Gimbal-lock configurations (singularities) are handled by setting the last rotation in the order to zero.
- multiply(other)[source]
Hamilton product
self * other.Composing rotations:
a.multiply(b)applies a first, then b in the rotated frame (intrinsic), or equivalently b first then a in the world frame (extrinsic).
- slerp(other, t)[source]
Spherical linear interpolation.
Always takes the shortest arc between the two orientations.
- x
- y
- z
- w
BoundingBox
- class dazpy.BoundingBox(min, max)[source]
Bases:
objectAxis-aligned bounding box.
- Parameters:
- classmethod from_dict(d)[source]
Create from the dict returned by
bounding_box().Expected shape:
{"min": {"x":..., "y":..., "z":...}, "max": {...}}.
- classmethod from_points(points)[source]
Compute the tight bounding box around a list of
Vec3points.
- min
- max
AxisRemap
- class dazpy.AxisRemap(x, y, z)[source]
Bases:
objectConverts
Vec3,Quat, andBoundingBoxvalues between axis conventions (e.g. Y-up to Z-up).A generic signed-axis-permutation remap — no application-specific knowledge (Blender/Unreal naming, camera or figure orientation fixups) is baked in beyond the
Y_UP_TO_Z_UPpreset.Each of x, y, z names which source axis (optionally signed) the corresponding output axis is derived from. All three of the source axes
x,y,zmust be referenced exactly once (signs aside).Example:
# DAZ Studio (Y-up) -> Blender-style Z-up remap = AxisRemap(x="x", y="-z", z="y") blender_pos = remap.apply_vec3(daz_pos)
- Parameters:
- apply_quat(q)[source]
Remap a rotation.
- Raises:
ValueError – If this remap is a reflection (determinant
-1). Reflections cannot be represented by a quaternion; useapply_vec3()for vectors/points instead.
- dazpy.Y_UP_TO_Z_UP = AxisRemap(x='x', y='-z', z='y')
Converts
Vec3,Quat, andBoundingBoxvalues between axis conventions (e.g. Y-up to Z-up).A generic signed-axis-permutation remap — no application-specific knowledge (Blender/Unreal naming, camera or figure orientation fixups) is baked in beyond the
Y_UP_TO_Z_UPpreset.Each of x, y, z names which source axis (optionally signed) the corresponding output axis is derived from. All three of the source axes
x,y,zmust be referenced exactly once (signs aside).Example:
# DAZ Studio (Y-up) -> Blender-style Z-up remap = AxisRemap(x="x", y="-z", z="y") blender_pos = remap.apply_vec3(daz_pos)
- Parameters:
x – Source axis for the output X component, e.g.
"x"or"-z".y – Source axis for the output Y component.
z – Source axis for the output Z component.