Type Definition nalgebra::geometry::Isometry3 [−][src]
type Isometry3<T> = Isometry<T, UnitQuaternion<T>, 3>;
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
impl<T: SimdRealField> Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<T: SimdRealField> Isometry3<T> where
T::Element: SimdRealField,
[src]pub fn new(translation: Vector3<T>, axisangle: Vector3<T>) -> Self
[src]
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);
pub fn translation(x: T, y: T, z: T) -> Self
[src]
Creates a new isometry from the given translation coordinates.
pub fn rotation(axisangle: Vector3<T>) -> Self
[src]
Creates a new isometry from the given rotation angle.
pub fn cast<To: Scalar>(self) -> Isometry3<To> where
Isometry3<To>: SupersetOf<Self>,
[src]
Isometry3<To>: SupersetOf<Self>,
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());
impl<T: SimdRealField> Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<T: SimdRealField> Isometry3<T> where
T::Element: SimdRealField,
[src]pub fn face_towards(
eye: &Point3<T>,
target: &Point3<T>,
up: &Vector3<T>
) -> Self
[src]
eye: &Point3<T>,
target: &Point3<T>,
up: &Vector3<T>
) -> Self
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());
pub fn new_observer_frame(
eye: &Point3<T>,
target: &Point3<T>,
up: &Vector3<T>
) -> Self
[src]
eye: &Point3<T>,
target: &Point3<T>,
up: &Vector3<T>
) -> Self
renamed to face_towards
Deprecated: Use Isometry::face_towards instead.
pub fn look_at_rh(eye: &Point3<T>, target: &Point3<T>, up: &Vector3<T>) -> Self
[src]
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());
pub fn look_at_lh(eye: &Point3<T>, target: &Point3<T>, up: &Vector3<T>) -> Self
[src]
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());
impl<T: SimdRealField> Isometry3<T>
[src]
impl<T: SimdRealField> Isometry3<T>
[src]pub fn lerp_slerp(&self, other: &Self, t: T) -> Self where
T: RealField,
[src]
T: RealField,
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: T, epsilon: T) -> Option<Self> where
T: RealField,
[src]
T: 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, T: SimdRealField> Div<&'b Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<'a, 'b, T: SimdRealField> Div<&'b Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the /
operator.
fn div(self, rhs: &'b UnitDualQuaternion<T>) -> Self::Output
[src]
impl<'b, T: SimdRealField> Div<&'b Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<'b, T: SimdRealField> Div<&'b Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the /
operator.
fn div(self, rhs: &'b UnitDualQuaternion<T>) -> Self::Output
[src]
impl<'a, T: SimdRealField> Div<Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<'a, T: SimdRealField> Div<Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the /
operator.
fn div(self, rhs: UnitDualQuaternion<T>) -> Self::Output
[src]
impl<T: SimdRealField> Div<Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<T: SimdRealField> Div<Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the /
operator.
fn div(self, rhs: UnitDualQuaternion<T>) -> Self::Output
[src]
impl<T: SimdRealField> From<Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<T: SimdRealField> From<Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]fn from(dq: UnitDualQuaternion<T>) -> Self
[src]
impl<'a, 'b, T: SimdRealField> Mul<&'b Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<'a, 'b, T: SimdRealField> Mul<&'b Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b UnitDualQuaternion<T>) -> Self::Output
[src]
impl<'b, T: SimdRealField> Mul<&'b Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<'b, T: SimdRealField> Mul<&'b Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: &'b UnitDualQuaternion<T>) -> Self::Output
[src]
impl<'a, T: SimdRealField> Mul<Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<'a, T: SimdRealField> Mul<Unit<DualQuaternion<T>>> for &'a Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: UnitDualQuaternion<T>) -> Self::Output
[src]
impl<T: SimdRealField> Mul<Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]
impl<T: SimdRealField> Mul<Unit<DualQuaternion<T>>> for Isometry3<T> where
T::Element: SimdRealField,
[src]type Output = UnitDualQuaternion<T>
The resulting type after applying the *
operator.
fn mul(self, rhs: UnitDualQuaternion<T>) -> Self::Output
[src]
impl<T1, T2> SubsetOf<Unit<DualQuaternion<T2>>> for Isometry3<T1> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
[src]
impl<T1, T2> SubsetOf<Unit<DualQuaternion<T2>>> for Isometry3<T1> where
T1: RealField,
T2: RealField + SupersetOf<T1>,
[src]