< prev index next >

src/java.desktop/share/classes/sun/awt/geom/Order3.java

Print this page




 106     }
 107 
 108     public static void addInstance(Vector<Curve> curves,
 109                                    double x0, double y0,
 110                                    double cx0, double cy0,
 111                                    double cx1, double cy1,
 112                                    double x1, double y1,
 113                                    int direction) {
 114         if (y0 > y1) {
 115             curves.add(new Order3(x1, y1, cx1, cy1, cx0, cy0, x0, y0,
 116                                   -direction));
 117         } else if (y1 > y0) {
 118             curves.add(new Order3(x0, y0, cx0, cy0, cx1, cy1, x1, y1,
 119                                   direction));
 120         }
 121     }
 122 
 123     /*
 124      * Return the count of the number of horizontal sections of the
 125      * specified cubic Bezier curve.  Put the parameters for the
 126      * horizontal sections into the specified <code>ret</code> array.
 127      * <p>
 128      * If we examine the parametric equation in t, we have:
 129      *   Py(t) = C0(1-t)^3 + 3CP0 t(1-t)^2 + 3CP1 t^2(1-t) + C1 t^3
 130      *         = C0 - 3C0t + 3C0t^2 - C0t^3 +
 131      *           3CP0t - 6CP0t^2 + 3CP0t^3 +
 132      *           3CP1t^2 - 3CP1t^3 +
 133      *           C1t^3
 134      *   Py(t) = (C1 - 3CP1 + 3CP0 - C0) t^3 +
 135      *           (3C0 - 6CP0 + 3CP1) t^2 +
 136      *           (3CP0 - 3C0) t +
 137      *           (C0)
 138      * If we take the derivative, we get:
 139      *   Py(t) = Dt^3 + At^2 + Bt + C
 140      *   dPy(t) = 3Dt^2 + 2At + B = 0
 141      *        0 = 3*(C1 - 3*CP1 + 3*CP0 - C0)t^2
 142      *          + 2*(3*CP1 - 6*CP0 + 3*C0)t
 143      *          + (3*CP0 - 3*C0)
 144      *        0 = 3*(C1 - 3*CP1 + 3*CP0 - C0)t^2
 145      *          + 3*2*(CP1 - 2*CP0 + C0)t
 146      *          + 3*(CP0 - C0)




 106     }
 107 
 108     public static void addInstance(Vector<Curve> curves,
 109                                    double x0, double y0,
 110                                    double cx0, double cy0,
 111                                    double cx1, double cy1,
 112                                    double x1, double y1,
 113                                    int direction) {
 114         if (y0 > y1) {
 115             curves.add(new Order3(x1, y1, cx1, cy1, cx0, cy0, x0, y0,
 116                                   -direction));
 117         } else if (y1 > y0) {
 118             curves.add(new Order3(x0, y0, cx0, cy0, cx1, cy1, x1, y1,
 119                                   direction));
 120         }
 121     }
 122 
 123     /*
 124      * Return the count of the number of horizontal sections of the
 125      * specified cubic Bezier curve.  Put the parameters for the
 126      * horizontal sections into the specified {@code ret} array.
 127      * <p>
 128      * If we examine the parametric equation in t, we have:
 129      *   Py(t) = C0(1-t)^3 + 3CP0 t(1-t)^2 + 3CP1 t^2(1-t) + C1 t^3
 130      *         = C0 - 3C0t + 3C0t^2 - C0t^3 +
 131      *           3CP0t - 6CP0t^2 + 3CP0t^3 +
 132      *           3CP1t^2 - 3CP1t^3 +
 133      *           C1t^3
 134      *   Py(t) = (C1 - 3CP1 + 3CP0 - C0) t^3 +
 135      *           (3C0 - 6CP0 + 3CP1) t^2 +
 136      *           (3CP0 - 3C0) t +
 137      *           (C0)
 138      * If we take the derivative, we get:
 139      *   Py(t) = Dt^3 + At^2 + Bt + C
 140      *   dPy(t) = 3Dt^2 + 2At + B = 0
 141      *        0 = 3*(C1 - 3*CP1 + 3*CP0 - C0)t^2
 142      *          + 2*(3*CP1 - 6*CP0 + 3*C0)t
 143      *          + (3*CP0 - 3*C0)
 144      *        0 = 3*(C1 - 3*CP1 + 3*CP0 - C0)t^2
 145      *          + 3*2*(CP1 - 2*CP0 + C0)t
 146      *          + 3*(CP0 - C0)


< prev index next >