Add an `abs` method to `Vector2F`
This commit is contained in:
parent
3433545a76
commit
440510a126
|
@ -131,6 +131,12 @@ impl Vector2F {
|
||||||
Vector2F(self.0.yx())
|
Vector2F(self.0.yx())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the vector (|x|, |y|).
|
||||||
|
#[inline]
|
||||||
|
pub fn abs(self) -> Vector2F {
|
||||||
|
Vector2F(self.0.abs())
|
||||||
|
}
|
||||||
|
|
||||||
/// Returns the coefficient when the given vector `a` is projected onto this one.
|
/// Returns the coefficient when the given vector `a` is projected onto this one.
|
||||||
///
|
///
|
||||||
/// That is, if this vector is `v` and this function returns `c`, then `proj_v a = cv`. In
|
/// That is, if this vector is `v` and this function returns `c`, then `proj_v a = cv`. In
|
||||||
|
|
Loading…
Reference in New Issue