pub struct RigidTransform {
pub rotation: [[f64; 3]; 3],
pub translation: Point3,
}Expand description
A proper rigid transform (rotation + translation, no scale, no mirror).
rotation is row-major: apply_vector(v) = rotation · v. Build one with
RigidTransform::new (validated) or the named constructors. The setup’s
model-to-machine transform is the ONLY rigid transform CAM applies to
geometry; display conversion back uses RigidTransform::inverse.
Fields§
§rotation: [[f64; 3]; 3]§translation: Point3Implementations§
Source§impl RigidTransform
impl RigidTransform
Sourcepub const ORTHONORMAL_EPS: f64 = 1e-9
pub const ORTHONORMAL_EPS: f64 = 1e-9
Tolerance used by RigidTransform::validate on the orthonormality residual.
pub fn identity() -> Self
Sourcepub fn new(
rotation: [[f64; 3]; 3],
translation: Point3,
) -> Result<Self, TransformError>
pub fn new( rotation: [[f64; 3]; 3], translation: Point3, ) -> Result<Self, TransformError>
Validated constructor: refuses non-finite, non-orthonormal or mirroring matrices.
pub fn translation(t: Point3) -> Self
Sourcepub fn axis_angle(
axis: Point3,
angle_rad: f64,
t: Point3,
) -> Result<Self, TransformError>
pub fn axis_angle( axis: Point3, angle_rad: f64, t: Point3, ) -> Result<Self, TransformError>
Rotation by angle_rad about the unit axis (right-hand rule), then translation t.
Sourcepub fn from_frame(
origin: Point3,
x_axis: Point3,
z_axis: Point3,
) -> Result<Self, TransformError>
pub fn from_frame( origin: Point3, x_axis: Point3, z_axis: Point3, ) -> Result<Self, TransformError>
The transform that maps a frame given in model coordinates (origin,
X axis, Z axis) onto the machine frame: the frame origin goes to the
machine origin, the frame’s X to +X and its Z to +Z. x_axis is
re-orthogonalized against z_axis.
pub fn validate(&self) -> Result<(), TransformError>
pub fn is_identity(&self) -> bool
pub fn apply_vector(&self, v: Point3) -> Point3
pub fn apply_point(&self, p: Point3) -> Point3
Sourcepub fn apply_bounds(&self, b: &Bounds3) -> Bounds3
pub fn apply_bounds(&self, b: &Bounds3) -> Bounds3
Transform a box: the box of the eight transformed corners.
Sourcepub fn then(&self, next: &RigidTransform) -> Self
pub fn then(&self, next: &RigidTransform) -> Self
self followed by next: (next ∘ self)(p) = next(self(p)).