Removes Mul alias for GeometricProduct.
This commit is contained in:
parent
1945e38881
commit
48b86638a5
3 changed files with 12 additions and 42 deletions
|
|
@ -592,42 +592,6 @@ impl MultiVectorClass {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn derive_multiplication<'a>(
|
|
||||||
name: &'static str,
|
|
||||||
geometric_product: &AstNode<'a>,
|
|
||||||
parameter_a: &Parameter<'a>,
|
|
||||||
parameter_b: &Parameter<'a>,
|
|
||||||
) -> AstNode<'a> {
|
|
||||||
let geometric_product_result = result_of_trait!(geometric_product);
|
|
||||||
AstNode::TraitImplementation {
|
|
||||||
result: Parameter {
|
|
||||||
name,
|
|
||||||
data_type: geometric_product_result.data_type.clone(),
|
|
||||||
},
|
|
||||||
parameters: vec![parameter_a.clone(), parameter_b.clone()],
|
|
||||||
body: vec![AstNode::ReturnStatement {
|
|
||||||
expression: Box::new(Expression {
|
|
||||||
size: 1,
|
|
||||||
content: ExpressionContent::InvokeInstanceMethod(
|
|
||||||
parameter_a.data_type.clone(),
|
|
||||||
Box::new(Expression {
|
|
||||||
size: 1,
|
|
||||||
content: ExpressionContent::Variable(parameter_a.name),
|
|
||||||
}),
|
|
||||||
geometric_product_result.name,
|
|
||||||
vec![(
|
|
||||||
DataType::MultiVector(parameter_b.multi_vector_class()),
|
|
||||||
Expression {
|
|
||||||
size: 1,
|
|
||||||
content: ExpressionContent::Variable(parameter_b.name),
|
|
||||||
},
|
|
||||||
)],
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
}],
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn derive_squared_magnitude<'a>(
|
pub fn derive_squared_magnitude<'a>(
|
||||||
name: &'static str,
|
name: &'static str,
|
||||||
scalar_product: &AstNode<'a>,
|
scalar_product: &AstNode<'a>,
|
||||||
|
|
|
||||||
|
|
@ -158,8 +158,6 @@ fn main() {
|
||||||
for (parameter_b, pair_trait_implementations) in pair_trait_implementations.values() {
|
for (parameter_b, pair_trait_implementations) in pair_trait_implementations.values() {
|
||||||
if let Some(geometric_product) = pair_trait_implementations.get("GeometricProduct") {
|
if let Some(geometric_product) = pair_trait_implementations.get("GeometricProduct") {
|
||||||
let geometric_product_result = result_of_trait!(geometric_product);
|
let geometric_product_result = result_of_trait!(geometric_product);
|
||||||
let multiplication = MultiVectorClass::derive_multiplication("Mul", &geometric_product, ¶meter_a, ¶meter_b);
|
|
||||||
emitter.emit(&multiplication).unwrap();
|
|
||||||
if parameter_a.multi_vector_class() == parameter_b.multi_vector_class()
|
if parameter_a.multi_vector_class() == parameter_b.multi_vector_class()
|
||||||
&& geometric_product_result.multi_vector_class() == parameter_a.multi_vector_class()
|
&& geometric_product_result.multi_vector_class() == parameter_a.multi_vector_class()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
16
src/lib.rs
16
src/lib.rs
|
|
@ -88,7 +88,9 @@ impl Powf for ppga2d::Translator {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
fn powf(self, exponent: f32) -> Self {
|
fn powf(self, exponent: f32) -> Self {
|
||||||
(ppga2d::Scalar::from([exponent]) * self.ln()).exp()
|
self.ln()
|
||||||
|
.geometric_product(ppga2d::Scalar::from([exponent]))
|
||||||
|
.exp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -127,7 +129,9 @@ impl Powf for ppga2d::Motor {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
fn powf(self, exponent: f32) -> Self {
|
fn powf(self, exponent: f32) -> Self {
|
||||||
(ppga2d::Scalar::from([exponent]) * self.ln()).exp()
|
self.ln()
|
||||||
|
.geometric_product(ppga2d::Scalar::from([exponent]))
|
||||||
|
.exp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,7 +156,9 @@ impl Powf for ppga3d::Translator {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
fn powf(self, exponent: f32) -> Self {
|
fn powf(self, exponent: f32) -> Self {
|
||||||
(ppga3d::Scalar::from([exponent]) * self.ln()).exp()
|
self.ln()
|
||||||
|
.geometric_product(ppga3d::Scalar::from([exponent]))
|
||||||
|
.exp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -196,7 +202,9 @@ impl Powf for ppga3d::Motor {
|
||||||
type Output = Self;
|
type Output = Self;
|
||||||
|
|
||||||
fn powf(self, exponent: f32) -> Self {
|
fn powf(self, exponent: f32) -> Self {
|
||||||
(ppga3d::Scalar::from([exponent]) * self.ln()).exp()
|
self.ln()
|
||||||
|
.geometric_product(ppga3d::Scalar::from([exponent]))
|
||||||
|
.exp()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue