Ejemplo n.º 1
0
 //-----------------------------------------------------ubspline_to_bezier
 public static void UbSplineToBezier(double x1, double y1,
                                     double x2, double y2,
                                     double x3, double y3,
                                     double x4, double y4,
                                     Curve4Points output)
 {
     // Trans. matrix Uniform BSpline to Bezier
     //
     //  1/6     4/6     1/6     0
     //  0       4/6     2/6     0
     //  0       2/6     4/6     0
     //  0       1/6     4/6     1/6
     //
     output.Set(
         (x1 + 4 * x2 + x3) / 6,
         (y1 + 4 * y2 + y3) / 6,
         (4 * x2 + 2 * x3) / 6,
         (4 * y2 + 2 * y3) / 6,
         (2 * x2 + 4 * x3) / 6,
         (2 * y2 + 4 * y3) / 6,
         (x2 + 4 * x3 + x4) / 6,
         (y2 + 4 * y3 + y4) / 6);
 }
Ejemplo n.º 2
0
 //------------------------------------------------------hermite_to_bezier
 public static void HermiteToBezier(double x1, double y1,
                                    double x2, double y2,
                                    double x3, double y3,
                                    double x4, double y4,
                                    Curve4Points output)
 {
     // Trans. matrix Hermite to Bezier
     //
     //  1       0       0       0
     //  1       0       1/3     0
     //  0       1       0       -1/3
     //  0       1       0       0
     //
     output.Set(
         x1,
         y1,
         (3 * x1 + x3) / 3,
         (3 * y1 + y3) / 3,
         (3 * x2 - x4) / 3,
         (3 * y2 - y4) / 3,
         x2,
         y2);
 }
Ejemplo n.º 3
0
 //-------------------------------------------------------catrom_to_bezier
 public static void CatromToBezier(double x1, double y1,
                                   double x2, double y2,
                                   double x3, double y3,
                                   double x4, double y4,
                                   Curve4Points output)
 {
     // Trans. matrix Catmull-Rom to Bezier
     //
     //  0       1       0       0
     //  -1/6    1       1/6     0
     //  0       1/6     1       -1/6
     //  0       0       1       0
     //
     output.Set(
         x2,
         y2,
         (-x1 + 6 * x2 + x3) / 6,
         (-y1 + 6 * y2 + y3) / 6,
         (x2 + 6 * x3 - x4) / 6,
         (y2 + 6 * y3 - y4) / 6,
         x3,
         y3);
 }