Transform3f

Struct Transform3f 

Source
pub struct Transform3f {
    pub matrix: [[f32; 4]; 4],
}
Expand description

3D transformation matrix (4x4 homogeneous transformation)

Fields§

§matrix: [[f32; 4]; 4]

4x4 transformation matrix in row-major order

Implementations§

Source§

impl Transform3f

Source

pub fn identity() -> Self

Create an identity transformation

§Examples
use fast_gicp::Transform3f;

let transform = Transform3f::identity();
assert_eq!(transform.matrix[0][0], 1.0);
assert_eq!(transform.matrix[3][3], 1.0);
Source

pub fn from_flat(data: &[f32; 16]) -> Self

Create transformation from flat array (row-major order)

§Examples
use fast_gicp::Transform3f;

let data = [
    1.0, 0.0, 0.0, 1.0,
    0.0, 1.0, 0.0, 2.0,
    0.0, 0.0, 1.0, 3.0,
    0.0, 0.0, 0.0, 1.0,
];
let transform = Transform3f::from_flat(&data);
assert_eq!(transform.matrix[0][3], 1.0); // x translation
assert_eq!(transform.matrix[1][3], 2.0); // y translation
assert_eq!(transform.matrix[2][3], 3.0); // z translation
Source

pub fn to_flat(&self) -> [f32; 16]

Convert to flat array (row-major order)

Source

pub fn from_translation(x: f32, y: f32, z: f32) -> Self

Create transformation from translation

Source

pub fn from_translation_array(translation: [f32; 3]) -> Self

Creates a transformation from a translation vector.

Source

pub fn translation(&self) -> Vector3<f32>

Get translation component

Source

pub fn set_translation(&mut self, x: f32, y: f32, z: f32)

Set translation component

Source

pub fn rotation(&self) -> Matrix3<f32>

Get rotation matrix (3x3 upper-left block)

Source

pub fn set_rotation(&mut self, rotation: [[f32; 3]; 3])

Set rotation matrix (3x3 upper-left block)

Source

pub fn from_rotation_translation( rotation: [[f32; 3]; 3], translation: [f32; 3], ) -> Self

Create transformation from rotation matrix and translation

Source

pub fn from_parts(translation: Vector3<f32>, rotation: Matrix3<f32>) -> Self

Create transformation from nalgebra translation and rotation

Source

pub fn from_rotation_matrix(rotation: &Matrix3<f32>) -> Self

Create transformation from a rotation matrix

Source

pub fn multiply(&self, other: &Transform3f) -> Self

Multiply two transformations

Source

pub fn compose(&self, other: &Transform3f) -> Transform3f

Composes this transformation with another (self * other).

Source

pub fn inverse(&self) -> Self

Compute inverse transformation

Source

pub fn transform_point(&self, point: &Vector3<f32>) -> Vector3<f32>

Transform a 3D point

Source

pub fn transform_point_array(&self, point: [f32; 3]) -> [f32; 3]

Transform a 3D point array

Source

pub fn from_isometry(isometry: &Isometry3<f32>) -> Self

Create from nalgebra Isometry3

Source

pub fn to_isometry(&self) -> Isometry3<f32>

Convert to nalgebra Isometry3

Source

pub fn matrix_data(&self) -> &[[f32; 4]; 4]

Get the raw 4x4 matrix in row-major order

Source

pub fn to_matrix(&self) -> Matrix4<f32>

Convert to nalgebra Matrix4

Source

pub fn from_matrix(matrix: &Matrix4<f32>) -> Self

Create from nalgebra Matrix4

Trait Implementations§

Source§

impl Clone for Transform3f

Source§

fn clone(&self) -> Transform3f

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Transform3f

Source§

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

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

impl Default for Transform3f

Source§

fn default() -> Self

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

impl From<&Transform3f> for Isometry3<f32>

Source§

fn from(transform: &Transform3f) -> Self

Converts to this type from the input type.
Source§

impl From<Isometry<f32, Unit<Quaternion<f32>>, 3>> for Transform3f

Source§

fn from(isometry: Isometry3<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<Matrix<f32, Const<4>, Const<4>, ArrayStorage<f32, 4, 4>>> for Transform3f

Source§

fn from(m: Matrix4<f32>) -> Self

Converts to this type from the input type.
Source§

impl From<Transform3f> for Isometry3<f32>

Source§

fn from(transform: Transform3f) -> Self

Converts to this type from the input type.
Source§

impl From<Transform3f> for Matrix4<f32>

Source§

fn from(t: Transform3f) -> Self

Converts to this type from the input type.
Source§

impl Mul for Transform3f

Source§

type Output = Transform3f

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Transform3f) -> Self::Output

Performs the * operation. Read more
Source§

impl MulAssign for Transform3f

Source§

fn mul_assign(&mut self, rhs: Transform3f)

Performs the *= operation. Read more
Source§

impl PartialEq for Transform3f

Source§

fn eq(&self, other: &Transform3f) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 Copy for Transform3f

Source§

impl StructuralPartialEq for Transform3f

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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.
Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,