2019-03-23 21:29:07 +08:00
|
|
|
use crate::aliases::TVec3;
|
|
|
|
use crate::traits::Number;
|
2018-09-21 01:54:12 +08:00
|
|
|
|
2018-09-22 19:18:59 +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)
|
2021-04-11 17:00:38 +08:00
|
|
|
pub fn left_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool {
|
|
|
|
a.cross(b).dot(c) < T::zero()
|
2018-09-21 01:54:12 +08:00
|
|
|
}
|
|
|
|
|
2018-09-22 19:18:59 +08:00
|
|
|
/// 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)
|
2021-04-11 17:00:38 +08:00
|
|
|
pub fn right_handed<T: Number>(a: &TVec3<T>, b: &TVec3<T>, c: &TVec3<T>) -> bool {
|
|
|
|
a.cross(b).dot(c) > T::zero()
|
2018-09-21 01:54:12 +08:00
|
|
|
}
|