simvx.core.math.transforms¶
Transform2D, Basis, and Transform3D — hierarchical placement types.
Module Contents¶
Classes¶
2D transform: position + rotation + scale with cached 3x3 matrix. |
|
3x3 rotation/scale matrix. Column access for right/up/forward. |
|
3D transform: position + rotation (quat) + scale with cached 4x4 matrix. |
API¶
- class simvx.core.math.transforms.Transform2D(position=(0, 0), rotation=0.0, scale=(1, 1))[source]¶
2D transform: position + rotation + scale with cached 3x3 matrix.
Initialization
- property position: numpy.ndarray¶
- property rotation: float¶
- property scale: numpy.ndarray¶
- property matrix: numpy.ndarray¶
- translated(offset) simvx.core.math.transforms.Transform2D[source]¶
Return a new transform with position shifted by offset.
- rotated(angle: float) simvx.core.math.transforms.Transform2D[source]¶
Return a new transform with additional rotation (radians).
- scaled(factor) simvx.core.math.transforms.Transform2D[source]¶
Return a new transform with scale multiplied by factor.
- inverse() simvx.core.math.transforms.Transform2D[source]¶
Return the inverse transform.
- class simvx.core.math.transforms.Basis(matrix: numpy.ndarray | None = None)[source]¶
3x3 rotation/scale matrix. Column access for right/up/forward.
Initialization
- __slots__¶
(‘_m’,)
- property x: numpy.ndarray¶
Right vector (first column).
- property y: numpy.ndarray¶
Up vector (second column).
- property z: numpy.ndarray¶
Forward vector (third column).
- rotated(axis, angle: float) simvx.core.math.transforms.Basis[source]¶
Return a new basis rotated around axis by angle (radians).
- scaled(s) simvx.core.math.transforms.Basis[source]¶
Return a new basis with columns scaled by s (scalar or 3-tuple).
- transposed() simvx.core.math.transforms.Basis[source]¶
Return transposed basis.
- inverse() simvx.core.math.transforms.Basis[source]¶
Return inverse of this basis.
- get_euler() tuple[float, float, float][source]¶
Extract Euler angles (pitch, yaw, roll) in radians from this basis.
Uses ZYX intrinsic rotation order (same as engine Quat convention).
- classmethod from_euler(euler) simvx.core.math.transforms.Basis[source]¶
Create basis from Euler angles (pitch, yaw, roll) in radians. ZYX order.
- classmethod from_axis_angle(axis, angle: float) simvx.core.math.transforms.Basis[source]¶
Create rotation basis from axis and angle (radians).
- class simvx.core.math.transforms.Transform3D(position=(0, 0, 0), rotation=None, scale=(1, 1, 1))[source]¶
3D transform: position + rotation (quat) + scale with cached 4x4 matrix.
Initialization
- property position: numpy.ndarray¶
- property rotation: simvx.core.math.types.Quat¶
- property scale: numpy.ndarray¶
- property matrix: numpy.ndarray¶
- translated(offset) simvx.core.math.transforms.Transform3D[source]¶
Return a new transform with position shifted by offset.
- rotated(axis, angle: float) simvx.core.math.transforms.Transform3D[source]¶
Return a new transform with additional rotation (angle in radians).
- scaled(factor) simvx.core.math.transforms.Transform3D[source]¶
Return a new transform with scale multiplied by factor.
- looking_at(target, up=(0, 1, 0)) simvx.core.math.transforms.Transform3D[source]¶
Return a new transform oriented to look at target.
- inverse() simvx.core.math.transforms.Transform3D[source]¶
Return the inverse transform.
- property basis: simvx.core.math.transforms.Basis¶
Return the 3x3 rotation/scale basis of this transform.