author Campbell Barton Mon, 20 Sep 2010 09:09:00 +0000 (09:09 +0000) committer Campbell Barton Mon, 20 Sep 2010 09:09:00 +0000 (09:09 +0000)
Quaternion interpolation was skipped which gave ugly stepping with the curve modifier (broke with my curve twist fix)

index 98bdf3b2e9fcbece4936f17db9599c1ff09c752f..6da9f2bbabc67d529e9c820f625bdfc5086633b3 100644 (file)
@@ -640,29 +640,19 @@ int where_on_path(Object *ob, float ctime, float *vec, float *dir, float *quat,
/* Need to verify the quat interpolation is correct - XXX */

if (quat) {
-               //float totfac, q1[4], q2[4];
+               float totfac, q1[4], q2[4];

-               /* checks for totfac are needed when 'fac' is 1.0 key_curve_position_weights can assign zero
-                * to more then one index in data which can give divide by zero error */
-/*
-               totfac= data[0]+data[1];
-               if(totfac>0.000001)     interp_qt_qtqt(q1, p0->quat, p1->quat, data[0] / totfac);
-               else                            QUATCOPY(q1, p1->quat);
+               totfac= data[0]+data[3];
+               if(totfac>FLT_EPSILON)  interp_qt_qtqt(q1, p0->quat, p3->quat, data[3] / totfac);
+               else                                    QUATCOPY(q1, p1->quat);

-               normalize_qt(q1);
-
-               totfac= data[2]+data[3];
-               if(totfac>0.000001)     interp_qt_qtqt(q2, p2->quat, p3->quat, data[2] / totfac);
-               else                            QUATCOPY(q1, p3->quat);
-               normalize_qt(q2);
+               totfac= data[1]+data[2];
+               if(totfac>FLT_EPSILON)  interp_qt_qtqt(q2, p1->quat, p2->quat, data[2] / totfac);
+               else                                    QUATCOPY(q1, p3->quat);

totfac = data[0]+data[1]+data[2]+data[3];
-               if(totfac>0.000001)     interp_qt_qtqt(quat, q1, q2, (data[0]+data[1]) / totfac);
-               else                            QUATCOPY(quat, q2);
-               normalize_qt(quat);
-               */
-               // XXX - find some way to make quat interpolation work correctly, above code fails in rare but nasty cases.
-               QUATCOPY(quat, p1->quat);
+               if(totfac>FLT_EPSILON)  interp_qt_qtqt(quat, q1, q2, (data[1]+data[2]) / totfac);
+               else                                    QUATCOPY(quat, q2);
}