Skip to content

Commit

Permalink
also for DQuat
Browse files Browse the repository at this point in the history
  • Loading branch information
Quartenia authored Dec 9, 2024
1 parent f6d3f18 commit 21ec0be
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/glam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,24 @@ impl Interpolate<f64> for DQuat {
}

fn cubic_hermite(t: f64, x: (f64, Self), a: (f64, Self), b: (f64, Self), y: (f64, Self)) -> Self {
unimplemented!("Need to figure this out for quaternions")
}
// sampler stuff
let two_t = t * 2.;
let three_t = t * 3.;
let t2 = t * t;
let t3 = t2 * t;
let two_t3 = t2 * two_t;
let two_t2 = t * two_t;
let three_t2 = t * three_t;

// tangents
let m0 = (b.1 - x.1) / (b.0 - x.0) * (b.0 - a.0);
let m1 = (y.1 - a.1) / (y.0 - a.0) * (b.0 - a.0);

a.1 * (two_t3 - three_t2 + 1.)
+ m0 * (t3 - two_t2 + t)
+ b.1 * (three_t2 - two_t3)
+ m1 * (t3 - t2)
}

fn quadratic_bezier(t: f64, a: Self, u: Self, b: Self) -> Self {
// ⚠️ UNTESTED ⚠️
Expand Down

0 comments on commit 21ec0be

Please sign in to comment.