pub struct Motion<T: Number = Scalar> { /* private fields */ }Expand description
An affine map as it moves geometry: a Pose’s rigid motion (see
Pose::motion), a plain translation, a mirror in a plane, or a
scaling (Motion::scaling, the one that is no isometry) — what a
body is moved, patterned, mirrored or scaled by.
A point p goes to A p + position, with A the matrix whose columns
are axes: a rotation’s, a mirror’s reflection or a scaling’s diagonal.
Without axes A is the identity and nothing is multiplied: a
translation moves every point by one addition per coordinate, as
exactly as an interval addition can.
Implementations§
Source§impl<T: Number> Motion<T>
impl<T: Number> Motion<T>
Sourcepub fn translation(offset: Vector3<T>) -> Self
pub fn translation(offset: Vector3<T>) -> Self
Moving every point by offset.
Sourcepub fn mirror(point: &Vector3<T>, normal: &Vector3<T>) -> GeopResult<Self>
pub fn mirror(point: &Vector3<T>, normal: &Vector3<T>) -> GeopResult<Self>
Mirroring in the plane through point with the normal normal,
which need not be unit: with n the unit normal, p goes to
p - 2 ((p - point) . n) n — A = I - 2 n nᵀ, and the position
2 (point . n) n.
Sourcepub fn mirrors(&self) -> bool
pub fn mirrors(&self) -> bool
Whether it mirrors: turns a right-handed frame into a left-handed one, and with it the side of a surface its normal points to.
Sourcepub fn turns(&self) -> bool
pub fn turns(&self) -> bool
Whether it turns or mirrors directions at all, rather than only moving points.
Sourcepub fn position(&self) -> Vector3<T>
pub fn position(&self) -> Vector3<T>
Where it moves the origin to: what it adds to every point it has turned.
Source§impl Motion
impl Motion
Sourcepub fn affine(columns: [Vector3; 3], position: Vector3) -> GeopResult<Self>
pub fn affine(columns: [Vector3; 3], position: Vector3) -> GeopResult<Self>
The affine map p -> A p + position, A the matrix whose columns
are columns: what a body is scaled by, or carried by past the end
of a deformation’s zone (geop_core_geometry::deform). No isometry
in general — lengths and angles change, directions it turns are no
longer unit, and only a body’s geometry is moved by it, whose NURBS
map exactly (an affine map of their homogeneous control points). It
mirrors where the determinant of A is negative, and fails where
the determinant could be zero, which would flatten everything.
Sourcepub fn scaling(center: &Vector3, factors: [Scalar; 3]) -> GeopResult<Self>
pub fn scaling(center: &Vector3, factors: [Scalar; 3]) -> GeopResult<Self>
Scaling about center by factors along x, y and z: p goes
to center + diag(factors) (p - center) (see Motion::affine).
An odd number of negative factors mirrors. Fails for a factor that
could be zero.
Sourcepub fn apply_frame(
&self,
frame: &CoordinateSystem,
) -> GeopResult<CoordinateSystem>
pub fn apply_frame( &self, frame: &CoordinateSystem, ) -> GeopResult<CoordinateSystem>
The frame frame moved. Fails for a mirror, which would leave it
left-handed.