Implement translator exponentiation for ppga2d

This commit is contained in:
Jim Eckerlein 2022-10-09 12:51:43 +02:00
parent 4ad771959c
commit 2462e5ea66

View file

@ -79,6 +79,37 @@ impl Powf for epga1d::ComplexNumber {
} }
} }
impl Exp for ppga2d::IdealPoint {
type Output = ppga2d::Translator;
fn exp(self) -> ppga2d::Translator {
ppga2d::Translator {
g0: simd::Simd32x3 {
f32x3: [1.0, self.g0[0], self.g0[1]],
}
}
}
}
impl Ln for ppga2d::Translator {
type Output = ppga2d::IdealPoint;
fn ln(self) -> ppga2d::IdealPoint {
ppga2d::IdealPoint {
g0: simd::Simd32x2 {
f32x2: [self.g0[1] / self.g0[0], self.g0[2] / self.g0[0]],
}
}
}
}
impl Powf for ppga2d::Translator {
type Output = Self;
fn powf(self, exponent: f32) -> Self {
(ppga2d::Scalar { g0: exponent } * self.ln()).exp()
}
}
impl Exp for ppga2d::Point { impl Exp for ppga2d::Point {
type Output = ppga2d::Motor; type Output = ppga2d::Motor;