mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-10 12:58:28 +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()
|
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
|
/// Compute the dot product with another vector
|
||||||
pub fn dot(&self, other: &Self) -> Scalar {
|
pub fn dot(&self, other: &Self) -> Scalar {
|
||||||
self.to_na().dot(&other.to_na()).into()
|
self.to_na().dot(&other.to_na()).into()
|
||||||
|
Loading…
Reference in New Issue
Block a user