Add Bivector::magnitude

This commit is contained in:
Hanno Braun 2024-07-29 18:54:48 +02:00
parent c38ab65562
commit 914bf84c7a

View File

@ -1,4 +1,4 @@
use crate::Vector;
use crate::{Scalar, Vector};
/// # An n-dimensional bivector
///
@ -27,3 +27,12 @@ pub struct Bivector<const D: usize> {
/// The second of the vectors whose outer product defines this bivector
pub b: Vector<D>,
}
impl<const D: usize> Bivector<D> {
/// Compute the magnitude of the bivector
pub fn magnitude(&self) -> Scalar {
self.a.angle_to(&self.b).sin().abs()
* self.a.magnitude()
* self.b.magnitude()
}
}