pub struct GeneralTransform {
pub linear: Matrix3,
pub translation: Vector,
}Expand description
A general affine transform: any linear part, plus a translation.
Non-uniform scaling and shear are allowed, so angles are not preserved and
analytic geometry does not survive intact. Kept distinct from Transform
so that cannot happen by accident.
Fields§
§linear: Matrix3The linear part.
translation: VectorThe translation.
Implementations§
Source§impl GeneralTransform
impl GeneralTransform
Sourcepub const fn new(linear: Matrix3, translation: Vector) -> Self
pub const fn new(linear: Matrix3, translation: Vector) -> Self
From a linear part and a translation.
Sourcepub const fn scaling_xyz(x: f64, y: f64, z: f64) -> Self
pub const fn scaling_xyz(x: f64, y: f64, z: f64) -> Self
Non-uniform scaling about the origin.
Sourcepub fn apply_vector(&self, v: Vector) -> Vector
pub fn apply_vector(&self, v: Vector) -> Vector
Apply to a free vector.
Sourcepub fn apply_normal(&self, n: Vector) -> OgeomResult<Vector>
pub fn apply_normal(&self, n: Vector) -> OgeomResult<Vector>
Apply to a normal vector.
Normals transform by the inverse transpose, not by the linear part itself. Using the linear part directly is only correct for a similarity; under any shear or non-uniform scale it tilts normals off the surface they belong to, which then breaks every orientation test downstream.
The result is not renormalized; it is a direction, not a length.
§Errors
OgeomError::Numeric if the linear part is
singular.
Sourcepub fn preserves_handedness(&self) -> bool
pub fn preserves_handedness(&self) -> bool
Whether this transform preserves handedness.
Sourcepub fn volume_ratio(&self) -> f64
pub fn volume_ratio(&self) -> f64
The factor by which volumes are multiplied. Negative if handedness flips.
Sourcepub fn is_similarity(&self, eps: f64) -> bool
pub fn is_similarity(&self, eps: f64) -> bool
Whether this is a similarity, and so can be narrowed to a Transform.
Trait Implementations§
Source§impl Clone for GeneralTransform
impl Clone for GeneralTransform
Source§fn clone(&self) -> GeneralTransform
fn clone(&self) -> GeneralTransform
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for GeneralTransform
Source§impl Debug for GeneralTransform
impl Debug for GeneralTransform
Source§impl Default for GeneralTransform
impl Default for GeneralTransform
Source§impl From<Transform> for GeneralTransform
impl From<Transform> for GeneralTransform
Source§impl Mul for GeneralTransform
impl Mul for GeneralTransform
Source§impl PartialEq for GeneralTransform
impl PartialEq for GeneralTransform
Source§fn eq(&self, other: &GeneralTransform) -> bool
fn eq(&self, other: &GeneralTransform) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for GeneralTransform
Auto Trait Implementations§
impl Freeze for GeneralTransform
impl RefUnwindSafe for GeneralTransform
impl Send for GeneralTransform
impl Sync for GeneralTransform
impl Unpin for GeneralTransform
impl UnsafeUnpin for GeneralTransform
impl UnwindSafe for GeneralTransform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.