Skip to main content

TransformationUniform

Struct TransformationUniform 

Source
pub struct TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>,
{ /* private fields */ }
Expand description

A transformation that is a translation . rotation . scaling (i.e. it applies a scaling to an object, then the rotation then translates it)

This supports only a uniform scaling

Trait Implementations§

Source§

impl<F, Q> Clone for TransformationUniform<F, Q>
where F: Float + Clone, Q: Quaternion<F> + Clone, FArray<F, 3>: Vector3<F>,

Source§

fn clone(&self) -> TransformationUniform<F, Q>

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<F, Q> Copy for TransformationUniform<F, Q>
where F: Float + Copy, Q: Quaternion<F> + Copy, FArray<F, 3>: Vector3<F>,

Source§

impl<F, Q> Debug for TransformationUniform<F, Q>
where F: Float + Debug, Q: Quaternion<F> + Debug, FArray<F, 3>: Vector3<F>,

Source§

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

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

impl<F, Q> Default for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>, FArray<F, 4>: Vector4<F>,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de, F, Q> Deserialize<'de> for TransformationUniform<F, Q>
where F: Float + Deserialize<'de> + Serialize, Q: Quaternion<F> + Deserialize<'de> + Serialize, FArray<F, 3>: Vector3<F> + DeserializeOwned + Serialize, FArray<F, 4>: Vector4<F>,

Available on crate feature serde only.
Source§

fn deserialize<DE>(deserializer: DE) -> Result<Self, DE::Error>
where DE: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<F, Q> Display for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>, FArray<F, 4>: Vector4<F>,

Source§

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

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

impl<F, Q> Div<F> for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>,

Source§

type Output = TransformationUniform<F, Q>

The resulting type after applying the / operator.
Source§

fn div(self, f: F) -> Self::Output

Performs the / operation. Read more
Source§

impl<F, Q> DivAssign<F> for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>,

Source§

fn div_assign(&mut self, f: F)

Performs the /= operation. Read more
Source§

impl<F, Q> Mul<F> for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>,

Source§

type Output = TransformationUniform<F, Q>

The resulting type after applying the * operator.
Source§

fn mul(self, f: F) -> Self::Output

Performs the * operation. Read more
Source§

impl<F, Q> Mul<FArray<F, 4>> for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>, FArray<F, 4>: Vector4<F>,

Source§

type Output = FArray<F, 4>

The resulting type after applying the * operator.
Source§

fn mul(self, v: FArray<F, 4>) -> Self::Output

Performs the * operation. Read more
Source§

impl<F, Q> MulAssign<F> for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>,

Source§

fn mul_assign(&mut self, f: F)

Performs the *= operation. Read more
Source§

impl<F, Q> PartialEq for TransformationUniform<F, Q>
where F: Float + PartialEq, Q: Quaternion<F> + PartialEq, FArray<F, 3>: Vector3<F>,

Source§

fn eq(&self, other: &TransformationUniform<F, Q>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F, Q> Serialize for TransformationUniform<F, Q>
where F: Float + for<'de> Deserialize<'de> + Serialize, Q: Quaternion<F> + for<'de> Deserialize<'de> + Serialize, FArray<F, 3>: Vector3<F> + DeserializeOwned + Serialize, FArray<F, 4>: Vector4<F> + Serialize,

Available on crate feature serde only.
Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<F, Q> StructuralPartialEq for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>,

Source§

impl<F, Q> Transform<F> for TransformationUniform<F, Q>
where F: Float, Q: Quaternion<F>, FArray<F, 3>: Vector3<F>, FArray<F, 4>: Vector4<F>,

Source§

const UNIFORM_SCALING: bool = true

Set to true if the transformation can only perform uniform scaling
Source§

type Vec3 = FArray<F, 3>

Type of vector comprehended as the translation/scaling for this transform
Source§

type Vec4 = FArray<F, 4>

Type of vector comprehended as the translation/scaling for this transform
Source§

type Quat = Q

Type of quaternion comprehended as the rotation for this transform
Source§

fn of_trs<A: AsRef<[F; 3]>>(t: A, r: Q, s: A) -> Option<Self>

Create a transformation that is a translation, rotation and scaling
Source§

fn of_trsu<A: AsRef<[F; 3]>>(t: A, r: Q, s: F) -> Self

Create a transformation that is a translation, rotation and uniform scaling
Source§

fn is_uniform_scale(&self) -> bool

Returns true if the scaling is uniform in each axis
Source§

fn scale(&self) -> Option<Self::Vec3>

Get the scale of the transform in each of the axes
Source§

fn uniform_scale(&self) -> Option<F>

Get the scale of the transform in each of the axes, if possible
Source§

fn translation(&self) -> Self::Vec3

Get a translation by a vector
Source§

fn rotation(&self) -> Option<Q>

Get the rotation of the transformation, if possible
Source§

fn set_identity(&mut self)

Set to an identity transformation
Source§

fn set_scale<A: AsRef<[F; 3]>>(&mut self, scale: A) -> bool

Set the scale of the transformation Read more
Source§

fn set_uniform_scale(&mut self, scale: F)

Set the scale of the transformation
Source§

fn set_translation<A: AsRef<[F; 3]>>(&mut self, translation: A)

Set the translation of the transformation
Source§

fn set_rotation(&mut self, rotation: Q)

Set the rotation of a transformation
Source§

fn scale_uniform_by(&mut self, scale: F)

Pre-apply a uniform scaling
Source§

fn scale_by<A: AsRef<[F; 3]>>(&mut self, scale: A) -> bool

Pre-apply a nonuniform scaling Read more
Source§

fn translate_by<A: AsRef<[F; 3]>>(&mut self, translation: A, scale: F)

Pre-apply a scaled translation to the transformation
Source§

fn rotate_by(&mut self, quaternion: &Q)

Rotate the transformation by a quaternion
Source§

fn transform_by<T: Transform<F, Quat = Self::Quat>>( &mut self, transformer: &T, ) -> bool

Transform this transformation by another UNIFORM scale transformation; if is not uniform scaling then return false
Source§

fn inverse_transform(&self) -> Option<Self>

Get the inverse transformation Read more
Source§

fn apply3_arr(&self, other: &[F; 3]) -> [F; 3]

Apply the transformation to a [F; 4]
Source§

fn apply4_arr(&self, other: &[F; 4]) -> [F; 4]

Apply the transformation to a [F; 4]
Source§

fn as_mat3<M: SqMatrix3<F>>(&self) -> M

Convert the non-translation to a 3-by-3 matrix
Source§

fn as_mat4<M: SqMatrix4<F>>(&self) -> M

Convert it to a 4-by-4 matrix
Source§

fn set_inverse(&mut self) -> bool

Invert the transformation Read more
Source§

fn set_mat4<M: SqMatrix4<F>>(&self, mat4: &mut M)

Convert it to a 4-by-4 matrix and set it
Source§

fn set_mat3<M: SqMatrix3<F>>(&self, mat3: &mut M)

Convert it to a 4-by-4 matrix and set it
Source§

fn apply3<T>(&self, other: T) -> T
where T: Deref<Target = [F; 3]> + From<[F; 3]>,

Apply the quaternion to a vector or similar
Source§

fn apply4<T>(&self, other: T) -> T
where T: Deref<Target = [F; 4]> + From<[F; 4]>,

Apply the transformation to a vector or similar

Auto Trait Implementations§

§

impl<F, Q> Freeze for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: Freeze, F: Freeze,

§

impl<F, Q> RefUnwindSafe for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: RefUnwindSafe, F: RefUnwindSafe,

§

impl<F, Q> Send for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: Send, F: Send,

§

impl<F, Q> Sync for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: Sync, F: Sync,

§

impl<F, Q> Unpin for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: Unpin, F: Unpin,

§

impl<F, Q> UnsafeUnpin for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: UnsafeUnpin, F: UnsafeUnpin,

§

impl<F, Q> UnwindSafe for TransformationUniform<F, Q>
where FArray<F, 3>: Sized, Q: UnwindSafe, F: 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.