@@ -119,7 +119,7 @@ impl Quat {
119
119
pub fn slerp ( self , b : Self , t : f32 ) -> Self {
120
120
debug_assert ! ( self . is_normalized( ) , "Quaternion `self` is not normalized" ) ;
121
121
debug_assert ! ( b. is_normalized( ) , "Quaternion `b` is not normalized" ) ;
122
- Self :: gd ( self . glam ( ) . slerp ( b. glam ( ) , t) )
122
+ Self :: gd ( self . glam ( ) . lerp ( b. glam ( ) , t) )
123
123
}
124
124
125
125
/// Returns the result of the spherical linear interpolation between this quaternion and `t` by
@@ -209,4 +209,23 @@ mod test {
209
209
let expect = Vector3 :: new ( -2.43176 , -0.874777 , -1.234427 ) ;
210
210
assert ! ( expect. is_equal_approx( quat * vec) ) ;
211
211
}
212
+
213
+ #[ test]
214
+ fn slerp ( ) {
215
+ let q = Quat :: new ( -0.635115 , -0.705592 , 0.314052 , 0.011812 ) ;
216
+ let p = Quat :: new ( 0.485489 , 0.142796 , -0.862501 , 0.001113 ) ;
217
+ let t = 0.2 ;
218
+ let e = Quat :: new ( -0.638517 , -0.620742 , 0.454844 , 0.009609 ) ;
219
+ dbg ! ( q. slerp( p, t) , e) ;
220
+ assert ! ( e. is_equal_approx( q. slerp( p, t) ) ) ;
221
+ }
222
+
223
+ #[ test]
224
+ fn slerpni ( ) {
225
+ let q = Quat :: new ( -0.635115 , -0.705592 , 0.314052 , 0.011812 ) ;
226
+ let p = Quat :: new ( 0.485489 , 0.142796 , -0.862501 , 0.001113 ) ;
227
+ let t = 0.2 ;
228
+ let e = Quat :: new ( -0.535331 , -0.836627 , -0.114954 , 0.016143 ) ;
229
+ assert ! ( e. is_equal_approx( q. slerpni( p, t) ) ) ;
230
+ }
212
231
}
0 commit comments