Moves implementation of Div to GeometricQuotient.

This commit is contained in:
Alexander Meißner 2022-11-26 14:32:11 +01:00
parent 48b86638a5
commit cdebda2e29
2 changed files with 10 additions and 3 deletions

View file

@ -180,7 +180,8 @@ fn main() {
} }
if let Some(b_trait_implementations) = trait_implementations.get(&parameter_b.multi_vector_class().class_name) { if let Some(b_trait_implementations) = trait_implementations.get(&parameter_b.multi_vector_class().class_name) {
if let Some(inverse) = b_trait_implementations.1.get("Inverse") { if let Some(inverse) = b_trait_implementations.1.get("Inverse") {
let division = MultiVectorClass::derive_division("Div", &geometric_product, &inverse, &parameter_a, &parameter_b); let division =
MultiVectorClass::derive_division("GeometricQuotient", &geometric_product, &inverse, &parameter_a, &parameter_b);
emitter.emit(&division).unwrap(); emitter.emit(&division).unwrap();
} }
} }

View file

@ -80,7 +80,7 @@ impl Ln for ppga2d::Translator {
fn ln(self) -> ppga2d::IdealPoint { fn ln(self) -> ppga2d::IdealPoint {
let result: ppga2d::IdealPoint = self.into(); let result: ppga2d::IdealPoint = self.into();
result / ppga2d::Scalar::from([self[0]]) result.geometric_product(ppga2d::Scalar::from([1.0 / self[0]]))
} }
} }
@ -148,7 +148,7 @@ impl Ln for ppga3d::Translator {
fn ln(self) -> ppga3d::IdealPoint { fn ln(self) -> ppga3d::IdealPoint {
let result: ppga3d::IdealPoint = self.into(); let result: ppga3d::IdealPoint = self.into();
result / ppga3d::Scalar::from([self[0]]) result.geometric_product(ppga3d::Scalar::from([1.0 / self[0]]))
} }
} }
@ -252,6 +252,12 @@ pub trait GeometricProduct<T> {
fn geometric_product(self, other: T) -> Self::Output; fn geometric_product(self, other: T) -> Self::Output;
} }
/// General multi vector division
pub trait GeometricQuotient<T> {
type Output;
fn geometric_quotient(self, other: T) -> Self::Output;
}
/// Dual of the geometric product grade filtered by `t == r + s` /// Dual of the geometric product grade filtered by `t == r + s`
/// ///
/// Also called join /// Also called join