Type Definition nalgebra::geometry::Isometry3 [−][src]
pub type Isometry3<N> = Isometry<N, U3, UnitQuaternion<N>>;
Expand description
A 3-dimensional direct isometry using a unit quaternion for its rotational part.
Because this is an alias, not all its methods are listed here. See the Isometry
type too.
Also known as a rigid-body motion, or as an element of SE(3).
Implementations
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.
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 - eye
and 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
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));
pub fn try_lerp_slerp(&self, other: &Self, t: N, epsilon: N) -> Option<Self> where
N: RealField,
pub fn try_lerp_slerp(&self, other: &Self, t: N, epsilon: N) -> Option<Self> where
N: RealField,
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));
Trait Implementations
impl<'a, 'b, N: SimdRealField> Div<&'b Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<'a, 'b, N: SimdRealField> Div<&'b Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the /
operator.
Performs the /
operation. Read more
impl<'b, N: SimdRealField> Div<&'b Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<'b, N: SimdRealField> Div<&'b Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the /
operator.
Performs the /
operation. Read more
impl<'a, N: SimdRealField> Div<Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<'a, N: SimdRealField> Div<Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the /
operator.
Performs the /
operation. Read more
impl<N: SimdRealField> Div<Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<N: SimdRealField> Div<Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the /
operator.
Performs the /
operation. Read more
impl<N: SimdRealField> From<Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
impl<N: SimdRealField> From<Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
Performs the conversion.
impl<'a, 'b, N: SimdRealField> Mul<&'b Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<'a, 'b, N: SimdRealField> Mul<&'b Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the *
operator.
Performs the *
operation. Read more
impl<'b, N: SimdRealField> Mul<&'b Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<'b, N: SimdRealField> Mul<&'b Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the *
operator.
Performs the *
operation. Read more
impl<'a, N: SimdRealField> Mul<Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<'a, N: SimdRealField> Mul<Unit<DualQuaternion<N>>> for &'a Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the *
operator.
Performs the *
operation. Read more
impl<N: SimdRealField> Mul<Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
impl<N: SimdRealField> Mul<Unit<DualQuaternion<N>>> for Isometry3<N> where
N::Element: SimdRealField,
DefaultAllocator: Allocator<N, U3, U1> + Allocator<N, U4, U1>,
type Output = UnitDualQuaternion<N>
type Output = UnitDualQuaternion<N>
The resulting type after applying the *
operator.
Performs the *
operation. Read more
impl<N1, N2> SubsetOf<Unit<DualQuaternion<N2>>> for Isometry3<N1> where
N1: RealField,
N2: RealField + SupersetOf<N1>,
impl<N1, N2> SubsetOf<Unit<DualQuaternion<N2>>> for Isometry3<N1> where
N1: RealField,
N2: RealField + SupersetOf<N1>,
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