Implement translator exponentiation for ppga2d
This commit is contained in:
parent
4ad771959c
commit
2462e5ea66
1 changed files with 31 additions and 0 deletions
31
src/lib.rs
31
src/lib.rs
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue