+ BReal one_minus_t = BReal(1) - t;
+
+ // X Coordinates
+ BReal x01 = x1*t + x0*one_minus_t;
+ BReal x12 = x2*t + x1*one_minus_t;
+ BReal x23 = x3*t + x2*one_minus_t;
+
+ BReal x012 = x12*t + x01*one_minus_t;
+ BReal x123 = x23*t + x12*one_minus_t;
+
+ BReal x0123 = x123*t + x012*one_minus_t;
+
+ // Y Coordinates
+ BReal y01 = y1*t + y0*one_minus_t;
+ BReal y12 = y2*t + y1*one_minus_t;
+ BReal y23 = y3*t + y2*one_minus_t;
+
+ BReal y012 = y12*t + y01*one_minus_t;
+ BReal y123 = y23*t + y12*one_minus_t;
+
+ BReal y0123 = y123*t + y012*one_minus_t;
+
+ return Bezier(x0, y0, x01, y01, x012, y012, x0123, y0123);
+ }
+ // Performs one round of De Casteljau subdivision and returns the [t,1] part.
+ Bezier DeCasteljauSubdivideRight(const BReal& t)
+ {
+ BReal one_minus_t = BReal(1) - t;
+
+ // X Coordinates
+ BReal x01 = x1*t + x0*one_minus_t;
+ BReal x12 = x2*t + x1*one_minus_t;
+ BReal x23 = x3*t + x2*one_minus_t;
+
+ BReal x012 = x12*t + x01*one_minus_t;
+ BReal x123 = x23*t + x12*one_minus_t;
+
+ BReal x0123 = x123*t + x012*one_minus_t;
+
+ // Y Coordinates
+ BReal y01 = y1*t + y0*one_minus_t;
+ BReal y12 = y2*t + y1*one_minus_t;
+ BReal y23 = y3*t + y2*one_minus_t;
+
+ BReal y012 = y12*t + y01*one_minus_t;
+ BReal y123 = y23*t + y12*one_minus_t;
+
+ BReal y0123 = y123*t + y012*one_minus_t;
+
+ return Bezier(x0123, y0123, x123, y123, x23, y23, x3, y3);
+ }
+
+ Bezier ReParametrise(const BReal& t0, const BReal& t1)
+ {
+ //Debug("Reparametrise: %f -> %f",Double(t0),Double(t1));