Add a function `nalgebra::center(a, b)` that computes the center of two points.
This commit is contained in:
parent
b3e7540b3c
commit
bf67f079e7
|
@ -350,10 +350,17 @@ pub fn one<T: One>() -> T {
|
||||||
|
|
||||||
/// Returns the trivial origin of an affine space.
|
/// Returns the trivial origin of an affine space.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn orig<T: Orig>() -> T {
|
pub fn orig<P: Orig>() -> P {
|
||||||
Orig::orig()
|
Orig::orig()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the center of two points.
|
||||||
|
#[inline]
|
||||||
|
pub fn center<N: Float, P: FloatPnt<N, V>, V>(a: &P, b: &P) -> P {
|
||||||
|
let _2 = one::<N>() + one();
|
||||||
|
(*a + *b.as_vec()) / _2
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FloatPnt
|
* FloatPnt
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue