nalgebra/nalgebra-glm/src/gtx/handed_coordinate_space.rs

21 lines
546 B
Rust
Raw Normal View History

2018-09-23 20:41:56 +08:00
use aliases::TVec3;
2018-10-22 04:11:27 +08:00
use traits::Number;
2018-09-21 01:54:12 +08:00
/// Returns `true` if `{a, b, c}` forms a left-handed trihedron.
2018-10-08 10:30:16 +08:00
///
/// # See also:
///
/// * [`right_handed`](fn.right_handed.html)
2018-09-23 20:41:56 +08:00
pub fn left_handed<N: Number>(a: &TVec3<N>, b: &TVec3<N>, c: &TVec3<N>) -> bool {
2018-09-21 01:54:12 +08:00
a.cross(b).dot(c) < N::zero()
}
/// Returns `true` if `{a, b, c}` forms a right-handed trihedron.
2018-10-08 10:30:16 +08:00
///
/// # See also:
///
/// * [`left_handed`](fn.left_handed.html)
2018-09-23 20:41:56 +08:00
pub fn right_handed<N: Number>(a: &TVec3<N>, b: &TVec3<N>, c: &TVec3<N>) -> bool {
2018-09-21 01:54:12 +08:00
a.cross(b).dot(c) > N::zero()
}