Skip to main content

Motion

Struct Motion 

Source
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>

Source

pub fn translation(offset: Vector3<T>) -> Self

Moving every point by offset.

Source

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.

Source

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.

Source

pub fn turns(&self) -> bool

Whether it turns or mirrors directions at all, rather than only moving points.

Source

pub fn position(&self) -> Vector3<T>

Where it moves the origin to: what it adds to every point it has turned.

Source

pub fn rotate(&self, d: &Vector3<T>) -> Vector3<T>

The direction d turned — or mirrored; a translation leaves it as it is.

Source

pub fn apply(&self, p: &Vector3<T>) -> Vector3<T>

The point p moved.

Source§

impl Motion

Source

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.

Source

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.

Source

pub fn apply_frame( &self, frame: &CoordinateSystem, ) -> GeopResult<CoordinateSystem>

The frame frame moved. Fails for a mirror, which would leave it left-handed.

Trait Implementations§

Source§

impl<T: Clone + Number> Clone for Motion<T>

Source§

fn clone(&self) -> Motion<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Copy + Number> Copy for Motion<T>

Source§

impl<T: Debug + Number> Debug for Motion<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: PartialEq + Number> PartialEq for Motion<T>

Source§

fn eq(&self, other: &Motion<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq + Number> StructuralPartialEq for Motion<T>

Auto Trait Implementations§

§

impl<T> Freeze for Motion<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Motion<T>
where T: RefUnwindSafe,

§

impl<T> Send for Motion<T>

§

impl<T> Sync for Motion<T>

§

impl<T> Unpin for Motion<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Motion<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Motion<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.