diff --git a/src/matrix.rs b/src/matrix.rs index eb668cf2..62335820 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -366,8 +366,10 @@ impl<S: BaseFloat> Matrix4<S> { Self::look_to_rh(eye, dir, up) } - /// Create a homogeneous transformation matrix that will cause a vector to point at - /// `dir`, using `up` for orientation. + /// Creates a homogeneous right-handed look-at transformation matrix. + /// + /// This matrix will transform a vector to point in `dir` direction, using `up` for orientation + /// assuming a right-handed corrdinate system. pub fn look_to_rh(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S> { let f = dir.normalize(); let s = f.cross(up).normalize(); @@ -382,8 +384,10 @@ impl<S: BaseFloat> Matrix4<S> { ) } - /// Create a homogeneous transformation matrix that will cause a vector to point at - /// `dir`, using `up` for orientation. + /// Creates a homogeneous left-handed look-at transformation matrix. + /// + /// This matrix will transform a vector to point in `dir` direction, using `up` for orientation + /// assuming a left-handed corrdinate system. pub fn look_to_lh(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S> { Matrix4::look_to_rh(eye, -dir, up) } @@ -395,14 +399,18 @@ impl<S: BaseFloat> Matrix4<S> { Matrix4::look_to_rh(eye, center - eye, up) } - /// Create a homogeneous transformation matrix that will cause a vector to point at - /// `center`, using `up` for orientation. + /// Creates a homogeneous right-handed look-at transformation matrix. + /// + /// This matrix will transform a vector to point at `center`, using `up` for orientation + /// assuming a right-handed corrdinate system. pub fn look_at_rh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> { Matrix4::look_to_rh(eye, center - eye, up) } - /// Create a homogeneous transformation matrix that will cause a vector to point at - /// `center`, using `up` for orientation. + /// Creates a homogeneous left-handed look-at transformation matrix. + /// + /// This matrix will transform a vector to point at `center`, using `up` for orientation + /// assuming a left-handed corrdinate system. pub fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> { Matrix4::look_to_lh(eye, center - eye, up) } diff --git a/src/rotation.rs b/src/rotation.rs index c39f6ea8..27f5b7b2 100644 --- a/src/rotation.rs +++ b/src/rotation.rs @@ -371,6 +371,7 @@ impl<'a, S: 'a + BaseFloat> iter::Product<&'a Basis3<S>> for Basis3<S> { impl<S: BaseFloat> Rotation for Basis3<S> { type Space = Point3<S>; + /// Construct a look-at view matrix assuming a left-handed coordinate system. #[inline] fn look_to(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> { Basis3 { diff --git a/src/transform.rs b/src/transform.rs index 9b0f55ca..0fae55a9 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -35,12 +35,16 @@ pub trait Transform<P: EuclideanSpace>: Sized + One { Self::look_at_lh(eye, center, up) } - /// Create a transformation that rotates a vector to look at `center` from - /// `eye`, using `up` for orientation. + /// Creates a right-handed look-at view transform. + /// + /// This transform rotates a vector to look at `center` from `eye`, using `up` for orientation + /// assuming a right-handed coordinate system. fn look_at_rh(eye: P, center: P, up: P::Diff) -> Self; - /// Create a transformation that rotates a vector to look at `center` from - /// `eye`, using `up` for orientation. + /// Creates a right-handed look-at view transform. + /// + /// This transform rotates a vector to look at `center` from `eye`, using `up` for orientation + /// assuming a left-handed coordinate system. fn look_at_lh(eye: P, center: P, up: P::Diff) -> Self; /// Transform a vector using this transform.