Skip to content

Commit d9d89de

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

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
@@ -371,6 +371,7 @@ impl<'a, S: 'a + BaseFloat> iter::Product<&'a Basis3<S>> for Basis3<S> {
371371
impl<S: BaseFloat> Rotation for Basis3<S> {
372372
type Space = Point3<S>;
373373

374+
/// Construct a look-at view matrix assuming a left-handed coordinate system.
374375
#[inline]
375376
fn look_to(dir: Vector3<S>, up: Vector3<S>) -> Basis3<S> {
376377
Basis3 {

src/transform.rs

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

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

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

4650
/// Transform a vector using this transform.

0 commit comments

Comments
 (0)