(bind-func cpvslerp
(lambda (v1:cpVect v2:cpVect t:cpFloat)
(let (
(dot (cpvdot (cpvnormalize v1) (cpvnormalize v2)))
(omega (acos (clamp dot -1. 1.))))
(if (< omega 0.001)
(cpvlerp v1 v2 t)
(let ((denom (/ 1.0 (sin omega))))
(cpvadd
(cpvmult v1 (* (sin (* (- 1.0 t) omega)) denom))
(cpvmult v2 (* (sin (* t omega)) denom))))))))