mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-04 01:48:28 +00:00
Add Bivector::magnitude
This commit is contained in:
parent
c38ab65562
commit
914bf84c7a
@ -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()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user