#[repr(C)]pub struct TypedTranslation3D<T, Src, Dst> {
pub x: T,
pub y: T,
pub z: T,
/* private fields */
}
Expand description
A 3d transformation from a space to another that can only express translations.
The main benefit of this type over a TypedVector3D is the ability to cast between a source and a destination spaces.
Fields§
§x: T
§y: T
§z: T
Implementations§
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
pub fn new(x: T, y: T, z: T) -> TypedTranslation3D<T, Src, Dst>
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>where
T: Copy,
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>where
T: Copy,
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
pub fn identity() -> TypedTranslation3D<T, Src, Dst>
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
pub fn is_identity(&self) -> bool
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
Sourcepub fn transform_point3d(
&self,
p: &TypedPoint3D<T, Src>,
) -> TypedPoint3D<T, Dst>
pub fn transform_point3d( &self, p: &TypedPoint3D<T, Src>, ) -> TypedPoint3D<T, Dst>
Translate a point and cast its unit.
Sourcepub fn transform_point2d(
&self,
p: &TypedPoint2D<T, Src>,
) -> TypedPoint2D<T, Dst>
pub fn transform_point2d( &self, p: &TypedPoint2D<T, Src>, ) -> TypedPoint2D<T, Dst>
Translate a point and cast its unit.
Sourcepub fn transform_rect(&self, r: &TypedRect<T, Src>) -> TypedRect<T, Dst>
pub fn transform_rect(&self, r: &TypedRect<T, Src>) -> TypedRect<T, Dst>
Translate a rectangle and cast its unit.
Sourcepub fn transform_size(&self, s: &TypedSize2D<T, Src>) -> TypedSize2D<T, Dst>
pub fn transform_size(&self, s: &TypedSize2D<T, Src>) -> TypedSize2D<T, Dst>
No-op, just cast the unit.
Sourcepub fn to_vector(&self) -> TypedVector3D<T, Src>
pub fn to_vector(&self) -> TypedVector3D<T, Src>
Cast into a 3D vector.
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
Sourcepub fn inverse(&self) -> TypedTranslation3D<T, Dst, Src>
pub fn inverse(&self) -> TypedTranslation3D<T, Dst, Src>
Return the inverse transformation.
Source§impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst>
Sourcepub fn to_transform(&self) -> TypedTransform3D<T, Src, Dst>
pub fn to_transform(&self) -> TypedTransform3D<T, Src, Dst>
Returns the matrix representation of this translation.
Trait Implementations§
Source§impl<T, Src, Dst1, Dst2> Add<TypedTranslation3D<T, Dst1, Dst2>> for TypedTranslation3D<T, Src, Dst1>
impl<T, Src, Dst1, Dst2> Add<TypedTranslation3D<T, Dst1, Dst2>> for TypedTranslation3D<T, Src, Dst1>
Source§type Output = TypedTranslation3D<T, Src, Dst2>
type Output = TypedTranslation3D<T, Src, Dst2>
The resulting type after applying the
+
operator.Source§fn add(
self,
other: TypedTranslation3D<T, Dst1, Dst2>,
) -> TypedTranslation3D<T, Src, Dst2>
fn add( self, other: TypedTranslation3D<T, Dst1, Dst2>, ) -> TypedTranslation3D<T, Src, Dst2>
Performs the
+
operation. Read moreSource§impl<T, Src, Dst> Clone for TypedTranslation3D<T, Src, Dst>where
T: Clone,
impl<T, Src, Dst> Clone for TypedTranslation3D<T, Src, Dst>where
T: Clone,
Source§fn clone(&self) -> TypedTranslation3D<T, Src, Dst>
fn clone(&self) -> TypedTranslation3D<T, Src, Dst>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T, Src, Dst> Debug for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> Debug for TypedTranslation3D<T, Src, Dst>
Source§impl<T, Src, Dst> Default for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> Default for TypedTranslation3D<T, Src, Dst>
Source§fn default() -> TypedTranslation3D<T, Src, Dst>
fn default() -> TypedTranslation3D<T, Src, Dst>
Returns the “default value” for a type. Read more
Source§impl<T, Src, Dst> From<TypedVector3D<T, Src>> for TypedTranslation3D<T, Src, Dst>where
T: Copy,
impl<T, Src, Dst> From<TypedVector3D<T, Src>> for TypedTranslation3D<T, Src, Dst>where
T: Copy,
Source§fn from(v: TypedVector3D<T, Src>) -> TypedTranslation3D<T, Src, Dst>
fn from(v: TypedVector3D<T, Src>) -> TypedTranslation3D<T, Src, Dst>
Converts to this type from the input type.
Source§impl<T, Src, Dst> Hash for TypedTranslation3D<T, Src, Dst>where
T: Hash,
impl<T, Src, Dst> Hash for TypedTranslation3D<T, Src, Dst>where
T: Hash,
Source§impl<T, Src, Dst> Into<TypedTransform3D<T, Src, Dst>> for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> Into<TypedTransform3D<T, Src, Dst>> for TypedTranslation3D<T, Src, Dst>
Source§fn into(self) -> TypedTransform3D<T, Src, Dst>
fn into(self) -> TypedTransform3D<T, Src, Dst>
Converts this type into the (usually inferred) input type.
Source§impl<T, Src, Dst> Into<TypedVector3D<T, Src>> for TypedTranslation3D<T, Src, Dst>where
T: Copy,
impl<T, Src, Dst> Into<TypedVector3D<T, Src>> for TypedTranslation3D<T, Src, Dst>where
T: Copy,
Source§fn into(self) -> TypedVector3D<T, Src>
fn into(self) -> TypedVector3D<T, Src>
Converts this type into the (usually inferred) input type.
Source§impl<T, Src, Dst> PartialEq for TypedTranslation3D<T, Src, Dst>where
T: PartialEq,
impl<T, Src, Dst> PartialEq for TypedTranslation3D<T, Src, Dst>where
T: PartialEq,
Source§fn eq(&self, other: &TypedTranslation3D<T, Src, Dst>) -> bool
fn eq(&self, other: &TypedTranslation3D<T, Src, Dst>) -> bool
Tests for
self
and other
values to be equal, and is used by ==
.Source§impl<T, Src, Dst1, Dst2> Sub<TypedTranslation3D<T, Dst1, Dst2>> for TypedTranslation3D<T, Src, Dst2>
impl<T, Src, Dst1, Dst2> Sub<TypedTranslation3D<T, Dst1, Dst2>> for TypedTranslation3D<T, Src, Dst2>
Source§type Output = TypedTranslation3D<T, Src, Dst1>
type Output = TypedTranslation3D<T, Src, Dst1>
The resulting type after applying the
-
operator.Source§fn sub(
self,
other: TypedTranslation3D<T, Dst1, Dst2>,
) -> TypedTranslation3D<T, Src, Dst1>
fn sub( self, other: TypedTranslation3D<T, Dst1, Dst2>, ) -> TypedTranslation3D<T, Src, Dst1>
Performs the
-
operation. Read moreimpl<T, Src, Dst> Copy for TypedTranslation3D<T, Src, Dst>where
T: Copy,
impl<T, Src, Dst> Eq for TypedTranslation3D<T, Src, Dst>where
T: Eq,
Auto Trait Implementations§
impl<T, Src, Dst> Freeze for TypedTranslation3D<T, Src, Dst>where
T: Freeze,
impl<T, Src, Dst> RefUnwindSafe for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> Send for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> Sync for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> Unpin for TypedTranslation3D<T, Src, Dst>
impl<T, Src, Dst> UnwindSafe for TypedTranslation3D<T, Src, Dst>
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
Mutably borrows from an owned value. Read more