Skip to content

Commit

Permalink
Add test for cubic_slerp
Browse files Browse the repository at this point in the history
  • Loading branch information
Demindiro committed Apr 5, 2021
1 parent bbbd287 commit 8263c05
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gdnative-core/src/core_types/quat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ mod test {
let p = Quat::new(0.485489, 0.142796, -0.862501, 0.001113);
let t = 0.2;
let e = Quat::new(-0.638517, -0.620742, 0.454844, 0.009609);
dbg!(q.slerp(p, t), e);
assert!(e.is_equal_approx(q.slerp(p, t)));
}

Expand All @@ -270,4 +269,15 @@ mod test {
let e = Quat::new(-0.535331, -0.836627, -0.114954, 0.016143);
assert!(e.is_equal_approx(q.slerpni(p, t)));
}

#[test]
fn cubic_slerp() {
let a = Quat::new(-0.635115, -0.705592, 0.314052, 0.011812);
let b = Quat::new(0.485489, 0.142796, -0.862501, 0.001113);
let c = Quat::new(-0.666276, 0.03859, 0.083527, -0.740007);
let d = Quat::new(-0.856633, -0.430228, -0.284017, 0.020464);
let t = 0.2;
let e = Quat::new(-0.768253, -0.490687, 0.341836, -0.22839);
assert!(e.is_equal_approx(a.cubic_slerp(b, c, d, t)));
}
}

0 comments on commit 8263c05

Please sign in to comment.