While looking into bug 1696331, I noticed that interpolation from zero tangents was...
[synfig.git] / synfig-core / trunk / src / synfig / valuenode_bline.cpp
index 83230cd..912c4a7 100644 (file)
@@ -63,6 +63,10 @@ linear_interpolation(const Vector& a, const Vector& b, float c)
 inline Vector
 radial_interpolation(const Vector& a, const Vector& b, float c)
 {
+       // if either extreme is zero then use linear interpolation instead
+       if (a.is_equal_to(Vector::zero()) || b.is_equal_to(Vector::zero()))
+               return linear_interpolation(a, b, c);
+
        affine_combo<Real,float> mag_combo;
        affine_combo<Angle,float> ang_combo;
 
@@ -511,6 +515,13 @@ ValueNode_BLine::operator()(Time t)const
                                float origin=next.get_origin()-curr.get_origin();
                                next_tangent_scalar=(1.0f-origin)*amount+origin;
                        }
+                       else
+                       {
+                               //! \todo this isn't quite right; we should handle looped blines identically no matter where the loop happens
+                               //! and we currently don't.  this at least makes it a lot better than it was before
+                               float origin=end.get_origin()-curr.get_origin();
+                               next_tangent_scalar=(1.0f-origin)*amount+origin;
+                       }
                        next_scale=next_tangent_scalar;
 
                        //ret.set_vertex((curr.get_vertex()-ret.get_vertex())*amount+ret.get_vertex());