math.quaternions: slerp function
parent
037dcdd735
commit
60561dd490
|
@ -1,6 +1,7 @@
|
||||||
! Copyright (C) 2005, 2007 Slava Pestov.
|
! Copyright (C) 2005, 2007 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays combinators kernel math math.functions math.libm math.vectors sequences ;
|
USING: arrays combinators kernel locals math math.functions
|
||||||
|
math.libm math.order math.vectors sequences ;
|
||||||
IN: math.quaternions
|
IN: math.quaternions
|
||||||
|
|
||||||
: q+ ( u v -- u+v )
|
: q+ ( u v -- u+v )
|
||||||
|
@ -67,3 +68,9 @@ PRIVATE>
|
||||||
|
|
||||||
: euler ( phi theta psi -- q )
|
: euler ( phi theta psi -- q )
|
||||||
{ } euler-like ; inline
|
{ } euler-like ; inline
|
||||||
|
|
||||||
|
:: slerp ( q0 q1 t -- qt )
|
||||||
|
q0 q1 v. -1.0 1.0 clamp :> dot
|
||||||
|
dot facos t * :> omega
|
||||||
|
q1 dot q0 n*v v- normalize :> qt'
|
||||||
|
omega fcos q0 n*v omega fsin qt' n*v v+ ; inline
|
||||||
|
|
Loading…
Reference in New Issue