Struct bevy_rapier2d::prelude::nalgebra::Isometry[][src]

#[repr(C)]
pub struct Isometry<T, R, const D: usize> where
    T: Scalar
{ pub rotation: R, pub translation: Translation<T, D>, }
Expand description

A direct isometry, i.e., a rotation followed by a translation (aka. a rigid-body motion).

This is also known as an element of a Special Euclidean (SE) group. The Isometry type can either represent a 2D or 3D isometry. A 2D isometry is composed of:

Note that instead of using the Isometry type in your code directly, you should use one of its aliases: Isometry2, Isometry3, IsometryMatrix2, IsometryMatrix3. Though keep in mind that all the documentation of all the methods of these aliases will also appears on this page.

Construction

Transformation and composition

Note that transforming vectors and points can be done by multiplication, e.g., isometry * point. Composing an isometry with another transformation can also be done by multiplication or division.

Conversion to a matrix

Fields

rotation: R

The pure rotational part of this isometry.

translation: Translation<T, D>

The pure translational part of this isometry.

Implementations

Creates a new isometry from its rotational and translational parts.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::PI);
let iso = Isometry3::from_parts(tra, rot);

assert_relative_eq!(iso * Point3::new(1.0, 2.0, 3.0), Point3::new(-1.0, 2.0, 0.0), epsilon = 1.0e-6);

Inverts self.

Example

let iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let inv = iso.inverse();
let pt = Point2::new(1.0, 2.0);

assert_eq!(inv * (iso * pt), pt);

Inverts self in-place.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let pt = Point2::new(1.0, 2.0);
let transformed_pt = iso * pt;
iso.inverse_mut();

assert_eq!(iso * transformed_pt, pt);

Computes self.inverse() * rhs in a more efficient way.

Example

let mut iso1 = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let mut iso2 = Isometry2::new(Vector2::new(10.0, 20.0), f32::consts::FRAC_PI_4);

assert_eq!(iso1.inverse() * iso2, iso1.inv_mul(&iso2));

Appends to self the given translation in-place.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let tra = Translation2::new(3.0, 4.0);
// Same as `iso = tra * iso`.
iso.append_translation_mut(&tra);

assert_eq!(iso.translation, Translation2::new(4.0, 6.0));

Appends to self the given rotation in-place.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::PI / 6.0);
let rot = UnitComplex::new(f32::consts::PI / 2.0);
// Same as `iso = rot * iso`.
iso.append_rotation_mut(&rot);

assert_relative_eq!(iso, Isometry2::new(Vector2::new(-2.0, 1.0), f32::consts::PI * 2.0 / 3.0), epsilon = 1.0e-6);

Appends in-place to self a rotation centered at the point p, i.e., the rotation that lets p invariant.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let rot = UnitComplex::new(f32::consts::FRAC_PI_2);
let pt = Point2::new(1.0, 0.0);
iso.append_rotation_wrt_point_mut(&rot, &pt);

assert_relative_eq!(iso * pt, Point2::new(-2.0, 0.0), epsilon = 1.0e-6);

Appends in-place to self a rotation centered at the point with coordinates self.translation.

Example

let mut iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);
let rot = UnitComplex::new(f32::consts::FRAC_PI_2);
iso.append_rotation_wrt_center_mut(&rot);

// The translation part should not have changed.
assert_eq!(iso.translation.vector, Vector2::new(1.0, 2.0));
assert_eq!(iso.rotation, UnitComplex::new(f32::consts::PI));

Transform the given point by this isometry.

This is the same as the multiplication self * pt.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.transform_point(&Point3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Point3::new(3.0, 2.0, 2.0), epsilon = 1.0e-6);

Transform the given vector by this isometry, ignoring the translation component of the isometry.

This is the same as the multiplication self * v.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.transform_vector(&Vector3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Vector3::new(3.0, 2.0, -1.0), epsilon = 1.0e-6);

Transform the given point by the inverse of this isometry. This may be less expensive than computing the entire isometry inverse and then transforming the point.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.inverse_transform_point(&Point3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Point3::new(0.0, 2.0, 1.0), epsilon = 1.0e-6);

Transform the given vector by the inverse of this isometry, ignoring the translation component of the isometry. This may be less expensive than computing the entire isometry inverse and then transforming the point.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::y() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.inverse_transform_vector(&Vector3::new(1.0, 2.0, 3.0));
assert_relative_eq!(transformed_point, Vector3::new(-3.0, 2.0, 1.0), epsilon = 1.0e-6);

Transform the given unit vector by the inverse of this isometry, ignoring the translation component of the isometry. This may be less expensive than computing the entire isometry inverse and then transforming the point.

Example

let tra = Translation3::new(0.0, 0.0, 3.0);
let rot = UnitQuaternion::from_scaled_axis(Vector3::z() * f32::consts::FRAC_PI_2);
let iso = Isometry3::from_parts(tra, rot);

let transformed_point = iso.inverse_transform_unit_vector(&Vector3::x_axis());
assert_relative_eq!(transformed_point, -Vector3::y_axis(), epsilon = 1.0e-6);

Converts this isometry into its equivalent homogeneous transformation matrix.

This is the same as self.to_matrix().

Example

let iso = Isometry2::new(Vector2::new(10.0, 20.0), f32::consts::FRAC_PI_6);
let expected = Matrix3::new(0.8660254, -0.5,      10.0,
                            0.5,       0.8660254, 20.0,
                            0.0,       0.0,       1.0);

assert_relative_eq!(iso.to_homogeneous(), expected, epsilon = 1.0e-6);

Converts this isometry into its equivalent homogeneous transformation matrix.

This is the same as self.to_homogeneous().

Example

let iso = Isometry2::new(Vector2::new(10.0, 20.0), f32::consts::FRAC_PI_6);
let expected = Matrix3::new(0.8660254, -0.5,      10.0,
                            0.5,       0.8660254, 20.0,
                            0.0,       0.0,       1.0);

assert_relative_eq!(iso.to_matrix(), expected, epsilon = 1.0e-6);

Creates a new identity isometry.

Example


let iso = Isometry2::identity();
let pt = Point2::new(1.0, 2.0);
assert_eq!(iso * pt, pt);

let iso = Isometry3::identity();
let pt = Point3::new(1.0, 2.0, 3.0);
assert_eq!(iso * pt, pt);

The isometry that applies the rotation r with its axis passing through the point p. This effectively lets p invariant.

Example

let rot = UnitComplex::new(f32::consts::PI);
let pt = Point2::new(1.0, 0.0);
let iso = Isometry2::rotation_wrt_point(rot, pt);

assert_eq!(iso * pt, pt); // The rotation center is not affected.
assert_relative_eq!(iso * Point2::new(1.0, 2.0), Point2::new(1.0, -2.0), epsilon = 1.0e-6);

Creates a new 2D isometry from a translation and a rotation angle.

Its rotational part is represented as a 2x2 rotation matrix.

Example

let iso = Isometry2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);

assert_eq!(iso * Point2::new(3.0, 4.0), Point2::new(-3.0, 5.0));

Creates a new isometry from the given translation coordinates.

Creates a new isometry from the given rotation angle.

Cast the components of self to another type.

Example

let iso = IsometryMatrix2::<f64>::identity();
let iso2 = iso.cast::<f32>();
assert_eq!(iso2, IsometryMatrix2::<f32>::identity());

Creates a new 2D isometry from a translation and a rotation angle.

Its rotational part is represented as an unit complex number.

Example

let iso = IsometryMatrix2::new(Vector2::new(1.0, 2.0), f32::consts::FRAC_PI_2);

assert_eq!(iso * Point2::new(3.0, 4.0), Point2::new(-3.0, 5.0));

Creates a new isometry from the given translation coordinates.

Creates a new isometry from the given rotation angle.

Cast the components of self to another type.

Example

let iso = Isometry2::<f64>::identity();
let iso2 = iso.cast::<f32>();
assert_eq!(iso2, Isometry2::<f32>::identity());

Creates a new isometry from a translation and a rotation axis-angle.

Example

let axisangle = Vector3::y() * f32::consts::FRAC_PI_2;
let translation = Vector3::new(1.0, 2.0, 3.0);
// Point and vector being transformed in the tests.
let pt = Point3::new(4.0, 5.0, 6.0);
let vec = Vector3::new(4.0, 5.0, 6.0);

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::new(translation, axisangle);
assert_relative_eq!(iso * pt, Point3::new(7.0, 7.0, -1.0), epsilon = 1.0e-6);
assert_relative_eq!(iso * vec, Vector3::new(6.0, 5.0, -4.0), epsilon = 1.0e-6);

// Isometry with its rotation part represented as a Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::new(translation, axisangle);
assert_relative_eq!(iso * pt, Point3::new(7.0, 7.0, -1.0), epsilon = 1.0e-6);
assert_relative_eq!(iso * vec, Vector3::new(6.0, 5.0, -4.0), epsilon = 1.0e-6);

Creates a new isometry from the given translation coordinates.

Creates a new isometry from the given rotation angle.

Cast the components of self to another type.

Example

let iso = Isometry3::<f64>::identity();
let iso2 = iso.cast::<f32>();
assert_eq!(iso2, Isometry3::<f32>::identity());

Creates a new isometry from a translation and a rotation axis-angle.

Example

let axisangle = Vector3::y() * f32::consts::FRAC_PI_2;
let translation = Vector3::new(1.0, 2.0, 3.0);
// Point and vector being transformed in the tests.
let pt = Point3::new(4.0, 5.0, 6.0);
let vec = Vector3::new(4.0, 5.0, 6.0);

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::new(translation, axisangle);
assert_relative_eq!(iso * pt, Point3::new(7.0, 7.0, -1.0), epsilon = 1.0e-6);
assert_relative_eq!(iso * vec, Vector3::new(6.0, 5.0, -4.0), epsilon = 1.0e-6);

// Isometry with its rotation part represented as a Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::new(translation, axisangle);
assert_relative_eq!(iso * pt, Point3::new(7.0, 7.0, -1.0), epsilon = 1.0e-6);
assert_relative_eq!(iso * vec, Vector3::new(6.0, 5.0, -4.0), epsilon = 1.0e-6);

Creates a new isometry from the given translation coordinates.

Creates a new isometry from the given rotation angle.

Cast the components of self to another type.

Example

let iso = IsometryMatrix3::<f64>::identity();
let iso2 = iso.cast::<f32>();
assert_eq!(iso2, IsometryMatrix3::<f32>::identity());

Creates an isometry that corresponds to the local frame of an observer standing at the point eye and looking toward target.

It maps the z axis to the view direction target - eyeand the origin to the eye.

Arguments

  • eye - The observer position.
  • target - The target position.
  • up - Vertical direction. The only requirement of this parameter is to not be collinear to eye - at. Non-collinearity is not checked.

Example

let eye = Point3::new(1.0, 2.0, 3.0);
let target = Point3::new(2.0, 2.0, 3.0);
let up = Vector3::y();

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::face_towards(&eye, &target, &up);
assert_eq!(iso * Point3::origin(), eye);
assert_relative_eq!(iso * Vector3::z(), Vector3::x());

// Isometry with its rotation part represented as Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::face_towards(&eye, &target, &up);
assert_eq!(iso * Point3::origin(), eye);
assert_relative_eq!(iso * Vector3::z(), Vector3::x());
👎 Deprecated:

renamed to face_towards

Deprecated: Use Isometry::face_towards instead.

Builds a right-handed look-at view matrix.

It maps the view direction target - eye to the negative z axis to and the eye to the origin. This conforms to the common notion of right handed camera look-at view matrix from the computer graphics community, i.e. the camera is assumed to look toward its local -z axis.

Arguments

  • eye - The eye position.
  • target - The target position.
  • up - A vector approximately aligned with required the vertical axis. The only requirement of this parameter is to not be collinear to target - eye.

Example

let eye = Point3::new(1.0, 2.0, 3.0);
let target = Point3::new(2.0, 2.0, 3.0);
let up = Vector3::y();

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::look_at_rh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), -Vector3::z());

// Isometry with its rotation part represented as Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::look_at_rh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), -Vector3::z());

Builds a left-handed look-at view matrix.

It maps the view direction target - eye to the positive z axis and the eye to the origin. This conforms to the common notion of right handed camera look-at view matrix from the computer graphics community, i.e. the camera is assumed to look toward its local z axis.

Arguments

  • eye - The eye position.
  • target - The target position.
  • up - A vector approximately aligned with required the vertical axis. The only requirement of this parameter is to not be collinear to target - eye.

Example

let eye = Point3::new(1.0, 2.0, 3.0);
let target = Point3::new(2.0, 2.0, 3.0);
let up = Vector3::y();

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::look_at_lh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), Vector3::z());

// Isometry with its rotation part represented as Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::look_at_lh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), Vector3::z());

Creates an isometry that corresponds to the local frame of an observer standing at the point eye and looking toward target.

It maps the z axis to the view direction target - eyeand the origin to the eye.

Arguments

  • eye - The observer position.
  • target - The target position.
  • up - Vertical direction. The only requirement of this parameter is to not be collinear to eye - at. Non-collinearity is not checked.

Example

let eye = Point3::new(1.0, 2.0, 3.0);
let target = Point3::new(2.0, 2.0, 3.0);
let up = Vector3::y();

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::face_towards(&eye, &target, &up);
assert_eq!(iso * Point3::origin(), eye);
assert_relative_eq!(iso * Vector3::z(), Vector3::x());

// Isometry with its rotation part represented as Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::face_towards(&eye, &target, &up);
assert_eq!(iso * Point3::origin(), eye);
assert_relative_eq!(iso * Vector3::z(), Vector3::x());
👎 Deprecated:

renamed to face_towards

Deprecated: Use Isometry::face_towards instead.

Builds a right-handed look-at view matrix.

It maps the view direction target - eye to the negative z axis to and the eye to the origin. This conforms to the common notion of right handed camera look-at view matrix from the computer graphics community, i.e. the camera is assumed to look toward its local -z axis.

Arguments

  • eye - The eye position.
  • target - The target position.
  • up - A vector approximately aligned with required the vertical axis. The only requirement of this parameter is to not be collinear to target - eye.

Example

let eye = Point3::new(1.0, 2.0, 3.0);
let target = Point3::new(2.0, 2.0, 3.0);
let up = Vector3::y();

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::look_at_rh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), -Vector3::z());

// Isometry with its rotation part represented as Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::look_at_rh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), -Vector3::z());

Builds a left-handed look-at view matrix.

It maps the view direction target - eye to the positive z axis and the eye to the origin. This conforms to the common notion of right handed camera look-at view matrix from the computer graphics community, i.e. the camera is assumed to look toward its local z axis.

Arguments

  • eye - The eye position.
  • target - The target position.
  • up - A vector approximately aligned with required the vertical axis. The only requirement of this parameter is to not be collinear to target - eye.

Example

let eye = Point3::new(1.0, 2.0, 3.0);
let target = Point3::new(2.0, 2.0, 3.0);
let up = Vector3::y();

// Isometry with its rotation part represented as a UnitQuaternion
let iso = Isometry3::look_at_lh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), Vector3::z());

// Isometry with its rotation part represented as Rotation3 (a 3x3 rotation matrix).
let iso = IsometryMatrix3::look_at_lh(&eye, &target, &up);
assert_eq!(iso * eye, Point3::origin());
assert_relative_eq!(iso * Vector3::x(), Vector3::z());

Interpolates between two isometries using a linear interpolation for the translation part, and a spherical interpolation for the rotation part.

Panics if the angle between both rotations is 180 degrees (in which case the interpolation is not well-defined). Use .try_lerp_slerp instead to avoid the panic.

Examples:


let t1 = Translation3::new(1.0, 2.0, 3.0);
let t2 = Translation3::new(4.0, 8.0, 12.0);
let q1 = UnitQuaternion::from_euler_angles(std::f32::consts::FRAC_PI_4, 0.0, 0.0);
let q2 = UnitQuaternion::from_euler_angles(-std::f32::consts::PI, 0.0, 0.0);
let iso1 = Isometry3::from_parts(t1, q1);
let iso2 = Isometry3::from_parts(t2, q2);

let iso3 = iso1.lerp_slerp(&iso2, 1.0 / 3.0);

assert_eq!(iso3.translation.vector, Vector3::new(2.0, 4.0, 6.0));
assert_eq!(iso3.rotation.euler_angles(), (std::f32::consts::FRAC_PI_2, 0.0, 0.0));

Attempts to interpolate between two isometries using a linear interpolation for the translation part, and a spherical interpolation for the rotation part.

Retuns None if the angle between both rotations is 180 degrees (in which case the interpolation is not well-defined).

Examples:


let t1 = Translation3::new(1.0, 2.0, 3.0);
let t2 = Translation3::new(4.0, 8.0, 12.0);
let q1 = UnitQuaternion::from_euler_angles(std::f32::consts::FRAC_PI_4, 0.0, 0.0);
let q2 = UnitQuaternion::from_euler_angles(-std::f32::consts::PI, 0.0, 0.0);
let iso1 = Isometry3::from_parts(t1, q1);
let iso2 = Isometry3::from_parts(t2, q2);

let iso3 = iso1.lerp_slerp(&iso2, 1.0 / 3.0);

assert_eq!(iso3.translation.vector, Vector3::new(2.0, 4.0, 6.0));
assert_eq!(iso3.rotation.euler_angles(), (std::f32::consts::FRAC_PI_2, 0.0, 0.0));

Interpolates between two isometries using a linear interpolation for the translation part, and a spherical interpolation for the rotation part.

Panics if the angle between both rotations is 180 degrees (in which case the interpolation is not well-defined). Use .try_lerp_slerp instead to avoid the panic.

Examples:


let t1 = Translation3::new(1.0, 2.0, 3.0);
let t2 = Translation3::new(4.0, 8.0, 12.0);
let q1 = Rotation3::from_euler_angles(std::f32::consts::FRAC_PI_4, 0.0, 0.0);
let q2 = Rotation3::from_euler_angles(-std::f32::consts::PI, 0.0, 0.0);
let iso1 = IsometryMatrix3::from_parts(t1, q1);
let iso2 = IsometryMatrix3::from_parts(t2, q2);

let iso3 = iso1.lerp_slerp(&iso2, 1.0 / 3.0);

assert_eq!(iso3.translation.vector, Vector3::new(2.0, 4.0, 6.0));
assert_eq!(iso3.rotation.euler_angles(), (std::f32::consts::FRAC_PI_2, 0.0, 0.0));

Attempts to interpolate between two isometries using a linear interpolation for the translation part, and a spherical interpolation for the rotation part.

Retuns None if the angle between both rotations is 180 degrees (in which case the interpolation is not well-defined).

Examples:


let t1 = Translation3::new(1.0, 2.0, 3.0);
let t2 = Translation3::new(4.0, 8.0, 12.0);
let q1 = Rotation3::from_euler_angles(std::f32::consts::FRAC_PI_4, 0.0, 0.0);
let q2 = Rotation3::from_euler_angles(-std::f32::consts::PI, 0.0, 0.0);
let iso1 = IsometryMatrix3::from_parts(t1, q1);
let iso2 = IsometryMatrix3::from_parts(t2, q2);

let iso3 = iso1.lerp_slerp(&iso2, 1.0 / 3.0);

assert_eq!(iso3.translation.vector, Vector3::new(2.0, 4.0, 6.0));
assert_eq!(iso3.rotation.euler_angles(), (std::f32::consts::FRAC_PI_2, 0.0, 0.0));

Interpolates between two isometries using a linear interpolation for the translation part, and a spherical interpolation for the rotation part.

Panics if the angle between both rotations is 180 degrees (in which case the interpolation is not well-defined). Use .try_lerp_slerp instead to avoid the panic.

Examples:


let t1 = Translation2::new(1.0, 2.0);
let t2 = Translation2::new(4.0, 8.0);
let q1 = UnitComplex::new(std::f32::consts::FRAC_PI_4);
let q2 = UnitComplex::new(-std::f32::consts::PI);
let iso1 = Isometry2::from_parts(t1, q1);
let iso2 = Isometry2::from_parts(t2, q2);

let iso3 = iso1.lerp_slerp(&iso2, 1.0 / 3.0);

assert_eq!(iso3.translation.vector, Vector2::new(2.0, 4.0));
assert_relative_eq!(iso3.rotation.angle(), std::f32::consts::FRAC_PI_2);

Interpolates between two isometries using a linear interpolation for the translation part, and a spherical interpolation for the rotation part.

Panics if the angle between both rotations is 180 degrees (in which case the interpolation is not well-defined). Use .try_lerp_slerp instead to avoid the panic.

Examples:


let t1 = Translation2::new(1.0, 2.0);
let t2 = Translation2::new(4.0, 8.0);
let q1 = Rotation2::new(std::f32::consts::FRAC_PI_4);
let q2 = Rotation2::new(-std::f32::consts::PI);
let iso1 = IsometryMatrix2::from_parts(t1, q1);
let iso2 = IsometryMatrix2::from_parts(t2, q2);

let iso3 = iso1.lerp_slerp(&iso2, 1.0 / 3.0);

assert_eq!(iso3.translation.vector, Vector2::new(2.0, 4.0));
assert_relative_eq!(iso3.rotation.angle(), std::f32::consts::FRAC_PI_2);

Trait Implementations

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more

The inverse of [AbsDiffEq::abs_diff_eq].

Performs the conversion.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the /= operation. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

Transform a vector by the absolute value of the homogeneous matrix equivalent to self. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Performs the *= operation. Read more

Creates a new identity isometry.

Sets self to the multiplicative identity element of Self, 1.

Returns true if self is equal to the multiplicative identity. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The default relative tolerance for testing values that are far-apart. Read more

A test for equality that uses a relative comparison if the values are far apart.

The inverse of [RelativeEq::relative_eq].

The type of the elements of each lane of this SIMD value.

Type of the result of comparing two SIMD values like self.

The number of lanes of this SIMD value.

Initializes an SIMD value with each lanes set to val.

Extracts the i-th lane of self. Read more

Extracts the i-th lane of self without bound-checking.

Replaces the i-th lane of self by val. Read more

Replaces the i-th lane of self by val without bound-checking.

Merges self and other depending on the lanes of cond. Read more

Applies a function to each lane of self. Read more

Applies a function to each lane of self paired with the corresponding lane of b. Read more

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The inclusion map: converts self to the equivalent element of its superset.

Checks if element is actually part of the subset Self (and can be converted to it).

Use with care! Same as self.to_superset but without any property checks. Always succeeds.

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The default ULPs to tolerate when testing values that are far-apart. Read more

A test for equality that uses units in the last place (ULP) if the values are far apart.

The inverse of [UlpsEq::ulps_eq].

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

Performance hack: Clone doesn’t get inlined for Copy types in debug mode, so make it inline anyway.

Tests if Self the same as the type T Read more

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

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

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

The inclusion map: converts self to the equivalent element of its superset.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.