Skip to content

Commit 46713c9

Browse files
committed
Update docs of look_* functions
This change clarifies the meaning of the _lh and _rh suffixes.
1 parent 1a007f2 commit 46713c9

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

src/matrix.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ impl<S: BaseFloat> Matrix4<S> {
366366
Self::look_to_rh(eye, dir, up)
367367
}
368368

369-
/// Create a homogeneous transformation matrix that will cause a vector to point at
370-
/// `dir`, using `up` for orientation.
369+
/// Creates a homogeneous right-handed look-at transformation matrix.
370+
///
371+
/// This matrix will transform a vector to point in `dir` direction, using `up` for orientation
372+
/// assuming a right-handed corrdinate system.
371373
pub fn look_to_rh(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S> {
372374
let f = dir.normalize();
373375
let s = f.cross(up).normalize();
@@ -382,8 +384,10 @@ impl<S: BaseFloat> Matrix4<S> {
382384
)
383385
}
384386

385-
/// Create a homogeneous transformation matrix that will cause a vector to point at
386-
/// `dir`, using `up` for orientation.
387+
/// Creates a homogeneous left-handed look-at transformation matrix.
388+
///
389+
/// This matrix will transform a vector to point in `dir` direction, using `up` for orientation
390+
/// assuming a left-handed corrdinate system.
387391
pub fn look_to_lh(eye: Point3<S>, dir: Vector3<S>, up: Vector3<S>) -> Matrix4<S> {
388392
Matrix4::look_to_rh(eye, -dir, up)
389393
}
@@ -395,14 +399,18 @@ impl<S: BaseFloat> Matrix4<S> {
395399
Matrix4::look_to_rh(eye, center - eye, up)
396400
}
397401

398-
/// Create a homogeneous transformation matrix that will cause a vector to point at
399-
/// `center`, using `up` for orientation.
402+
/// Creates a homogeneous right-handed look-at transformation matrix.
403+
///
404+
/// This matrix will transform a vector to point at `center`, using `up` for orientation
405+
/// assuming a right-handed corrdinate system.
400406
pub fn look_at_rh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {
401407
Matrix4::look_to_rh(eye, center - eye, up)
402408
}
403409

404-
/// Create a homogeneous transformation matrix that will cause a vector to point at
405-
/// `center`, using `up` for orientation.
410+
/// Creates a homogeneous left-handed look-at transformation matrix.
411+
///
412+
/// This matrix will transform a vector to point at `center`, using `up` for orientation
413+
/// assuming a left-handed corrdinate system.
406414
pub fn look_at_lh(eye: Point3<S>, center: Point3<S>, up: Vector3<S>) -> Matrix4<S> {
407415
Matrix4::look_to_lh(eye, center - eye, up)
408416
}

src/rotation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ impl<'a, S: 'a + BaseFloat> iter::Product<&'a Basis3<S>> for Basis3<S> {
341341
}
342342

343343
impl<S: BaseFloat> Rotation<Point3<S>> for Basis3<S> {
344+
/// Construct a look-at view matrix assuming a left-handed coordinate system.
344345
#[inline]
345346
fn look_to(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> {
346347
Basis3 {

src/transform.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ pub trait Transform<P: EuclideanSpace>: Sized {
3737
Self::look_at_lh(eye, center, up)
3838
}
3939

40-
/// Create a transformation that rotates a vector to look at `center` from
41-
/// `eye`, using `up` for orientation.
40+
/// Creates a right-handed look-at view transform.
41+
///
42+
/// This transform rotates a vector to look at `center` from `eye`, using `up` for orientation
43+
/// assuming a right-handed coordinate system.
4244
fn look_at_rh(eye: P, center: P, up: P::Diff) -> Self;
4345

44-
/// Create a transformation that rotates a vector to look at `center` from
45-
/// `eye`, using `up` for orientation.
46+
/// Creates a right-handed look-at view transform.
47+
///
48+
/// This transform rotates a vector to look at `center` from `eye`, using `up` for orientation
49+
/// assuming a left-handed coordinate system.
4650
fn look_at_lh(eye: P, center: P, up: P::Diff) -> Self;
4751

4852
/// Transform a vector using this transform.

0 commit comments

Comments
 (0)