mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-08 11:58:27 +00:00
Add Vector::angle_to
This commit is contained in:
parent
06baede8e7
commit
c38ab65562
@ -87,6 +87,11 @@ impl<const D: usize> Vector<D> {
|
||||
self.to_na().normalize().into()
|
||||
}
|
||||
|
||||
/// Compute the angle between this vector and another
|
||||
pub fn angle_to(&self, other: &Self) -> Scalar {
|
||||
(self.dot(other) / (self.magnitude() * other.magnitude())).acos()
|
||||
}
|
||||
|
||||
/// Compute the dot product with another vector
|
||||
pub fn dot(&self, other: &Self) -> Scalar {
|
||||
self.to_na().dot(&other.to_na()).into()
|
||||
|
Loading…
Reference in New Issue
Block a user