fuck you, you cant put your couch there
[carveJwlIkooP6JGAAIwe30JlM.git] / skeleton.h
index 2fcfb5023f171540b517c989a918914061a8c754..2595cda8c6476254700f6da43eac496dd4ffbd24 100644 (file)
@@ -73,6 +73,22 @@ VG_STATIC void keyframe_copy_pose( mdl_keyframe *kfa, mdl_keyframe *kfb,
       kfb[i] = kfa[i];
 }
 
+
+/* apply a rotation from the perspective of root */
+VG_STATIC void keyframe_rotate_around( mdl_keyframe *kf, 
+                                       v3f origin, v3f offset, v4f q )
+{
+   v3f v0, co;
+   v3_add( kf->co, offset, co );
+   v3_sub( co, origin, v0 );
+   q_mulv( q, v0, v0 );
+   v3_add( v0, origin, co );
+   v3_sub( co, offset, kf->co );
+
+   q_mul( q, kf->q, kf->q );
+   q_normalize( kf->q );
+}
+
 /*
  * Lerp between two sets of keyframes and store in dest. Rotations use Nlerp.
  */