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
impl Transform3f
Sourcepub fn identity() -> Self
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);Sourcepub fn from_flat(data: &[f32; 16]) -> Self
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 translationSourcepub fn from_translation(x: f32, y: f32, z: f32) -> Self
pub fn from_translation(x: f32, y: f32, z: f32) -> Self
Create transformation from translation
Sourcepub fn from_translation_array(translation: [f32; 3]) -> Self
pub fn from_translation_array(translation: [f32; 3]) -> Self
Creates a transformation from a translation vector.
Sourcepub fn translation(&self) -> Vector3<f32>
pub fn translation(&self) -> Vector3<f32>
Get translation component
Sourcepub fn set_translation(&mut self, x: f32, y: f32, z: f32)
pub fn set_translation(&mut self, x: f32, y: f32, z: f32)
Set translation component
Sourcepub fn set_rotation(&mut self, rotation: [[f32; 3]; 3])
pub fn set_rotation(&mut self, rotation: [[f32; 3]; 3])
Set rotation matrix (3x3 upper-left block)
Sourcepub fn from_rotation_translation(
rotation: [[f32; 3]; 3],
translation: [f32; 3],
) -> Self
pub fn from_rotation_translation( rotation: [[f32; 3]; 3], translation: [f32; 3], ) -> Self
Create transformation from rotation matrix and translation
Sourcepub fn from_parts(translation: Vector3<f32>, rotation: Matrix3<f32>) -> Self
pub fn from_parts(translation: Vector3<f32>, rotation: Matrix3<f32>) -> Self
Create transformation from nalgebra translation and rotation
Sourcepub fn from_rotation_matrix(rotation: &Matrix3<f32>) -> Self
pub fn from_rotation_matrix(rotation: &Matrix3<f32>) -> Self
Create transformation from a rotation matrix
Sourcepub fn multiply(&self, other: &Transform3f) -> Self
pub fn multiply(&self, other: &Transform3f) -> Self
Multiply two transformations
Sourcepub fn compose(&self, other: &Transform3f) -> Transform3f
pub fn compose(&self, other: &Transform3f) -> Transform3f
Composes this transformation with another (self * other).
Sourcepub fn from_isometry(isometry: &Isometry3<f32>) -> Self
pub fn from_isometry(isometry: &Isometry3<f32>) -> Self
Create from nalgebra Isometry3
Sourcepub fn to_isometry(&self) -> Isometry3<f32>
pub fn to_isometry(&self) -> Isometry3<f32>
Convert to nalgebra Isometry3
Sourcepub fn matrix_data(&self) -> &[[f32; 4]; 4]
pub fn matrix_data(&self) -> &[[f32; 4]; 4]
Get the raw 4x4 matrix in row-major order
Sourcepub fn from_matrix(matrix: &Matrix4<f32>) -> Self
pub fn from_matrix(matrix: &Matrix4<f32>) -> Self
Create from nalgebra Matrix4
Trait Implementations§
Source§impl Clone for Transform3f
impl Clone for Transform3f
Source§fn clone(&self) -> Transform3f
fn clone(&self) -> Transform3f
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 Debug for Transform3f
impl Debug for Transform3f
Source§impl Default for Transform3f
impl Default for Transform3f
Source§impl From<&Transform3f> for Isometry3<f32>
impl From<&Transform3f> for Isometry3<f32>
Source§fn from(transform: &Transform3f) -> Self
fn from(transform: &Transform3f) -> Self
Converts to this type from the input type.
Source§impl From<Isometry<f32, Unit<Quaternion<f32>>, 3>> for Transform3f
impl From<Isometry<f32, Unit<Quaternion<f32>>, 3>> for Transform3f
Source§impl From<Matrix<f32, Const<4>, Const<4>, ArrayStorage<f32, 4, 4>>> for Transform3f
impl From<Matrix<f32, Const<4>, Const<4>, ArrayStorage<f32, 4, 4>>> for Transform3f
Source§impl From<Transform3f> for Isometry3<f32>
impl From<Transform3f> for Isometry3<f32>
Source§fn from(transform: Transform3f) -> Self
fn from(transform: Transform3f) -> Self
Converts to this type from the input type.
Source§impl From<Transform3f> for Matrix4<f32>
impl From<Transform3f> for Matrix4<f32>
Source§fn from(t: Transform3f) -> Self
fn from(t: Transform3f) -> Self
Converts to this type from the input type.
Source§impl Mul for Transform3f
impl Mul for Transform3f
Source§type Output = Transform3f
type Output = Transform3f
The resulting type after applying the
* operator.Source§impl MulAssign for Transform3f
impl MulAssign for Transform3f
Source§fn mul_assign(&mut self, rhs: Transform3f)
fn mul_assign(&mut self, rhs: Transform3f)
Performs the
*= operation. Read moreSource§impl PartialEq for Transform3f
impl PartialEq for Transform3f
impl Copy for Transform3f
impl StructuralPartialEq for Transform3f
Auto Trait Implementations§
impl Freeze for Transform3f
impl RefUnwindSafe for Transform3f
impl Send for Transform3f
impl Sync for Transform3f
impl Unpin for Transform3f
impl UnwindSafe for Transform3f
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.