Examples of CubicCurve2D


Examples of java.awt.geom.CubicCurve2D

  }


  public void test_untransformed(TestHarness harness)
  {
    CubicCurve2D curve;
    PathIterator pit;
    double[] c = new double[6];

    harness.checkPoint("untransformed");
    curve = new CubicCurve2D.Double(1, 2, 3, 4, 5, 6, 7, 8);
    pit = curve.getPathIterator(null);

    harness.check(!pit.isDone());                                   // 1
    harness.check(pit.currentSegment(c), PathIterator.SEG_MOVETO)// 2
    harness.check(c[0], 1.0);                                       // 3
    harness.check(c[1], 2.0);                                       // 4
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  }


  public void test_transformed(TestHarness harness)
  {
    CubicCurve2D curve;
    PathIterator pit;
    AffineTransform tx;
    double[] c = new double[6];

    harness.checkPoint("transformed");
    tx = new AffineTransform();
    tx.scale(2, 3);
    tx.translate(1, -1);
    curve = new CubicCurve2D.Double(1, 2, 3, 4, 5, 6, 7, 8);
    pit = curve.getPathIterator(tx);

    harness.check(!pit.isDone());                                   // 1
    harness.check(pit.currentSegment(c), PathIterator.SEG_MOVETO)// 2
    harness.check(c[0], 4.0);                                       // 3
    harness.check(c[1], 3.0);                                       // 4
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  /**
   * Checks whether the zero-argument constructor works as specified.
   */
  public void testZeroArgs()
  {
    CubicCurve2D curve;

    h.checkPoint("noArgs");
    curve = new CubicCurve2D.Double();
    h.check(curve.getX1(), 0);      // 1
    h.check(curve.getY1(), 0);      // 2
    h.check(curve.getCtrlX1(), 0)// 3
    h.check(curve.getCtrlY1(), 0)// 4
    h.check(curve.getCtrlX2(), 0)// 5
    h.check(curve.getCtrlY2(), 0)// 6
    h.check(curve.getX2(), 0);      // 7
    h.check(curve.getY2(), 0);      // 8
  }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  /**
   * Checks whether the zero-argument constructor works as specified.
   */
  public void testZeroArgs()
  {
    CubicCurve2D curve;

    h.checkPoint("noArgs");
    curve = new CubicCurve2D.Float();
    h.check(curve.getX1(), 0);      // 1
    h.check(curve.getY1(), 0);      // 2
    h.check(curve.getCtrlX1(), 0)// 3
    h.check(curve.getCtrlY1(), 0)// 4
    h.check(curve.getCtrlX2(), 0)// 5
    h.check(curve.getCtrlY2(), 0)// 6
    h.check(curve.getX2(), 0);      // 7
    h.check(curve.getY2(), 0);      // 8
  }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

        Point2D quad_mid_point  = quadMidPoint(curve, control);
        double dist = quad_mid_point.distance( cubic_mid_point );

        if (dist > 0.5) // check if the cubic and quad curve overlapp
        {
            CubicCurve2D left  = new CubicCurve2D.Double();
            CubicCurve2D right = new CubicCurve2D.Double();
            curve.subdivide( left, right ); // split the cubic curve to a left and a right curve
           
            testCubic( quad_curves, left );   // recursive call to test the left  curve
            testCubic( quad_curves, right )// recursive call to test the right curve
        }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

                    last_y = coords[3];
                    curve( coords[2], coords[3], coords[0], coords[1] );
                    break;
                case PathIterator.SEG_CUBICTO:
                    QuadCurve2D draw = null;
                    CubicCurve2D curve = new CubicCurve2D.Double(last_x, last_y, coords[0], coords[1], coords[2], coords[3], coords[4], coords[5] );
                    ArrayList curves = convertCubicToQuadric(curve);
                    for (int i = 0; i < curves.size(); i++)
                    {
                        draw = (QuadCurve2D) curves.get(i);
                        curve( draw.getX2(), draw.getY2(), draw.getCtrlX(), draw.getCtrlY() );
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

            ((v1.getCtrlY1() - v0.getCtrlY1()) * fraction);
        double ctrlx2 = v0.getCtrlX2() +
            ((v1.getCtrlX2() - v0.getCtrlX2()) * fraction);
        double ctrly2 = v0.getCtrlY2() +
            ((v1.getCtrlY2() - v0.getCtrlY2()) * fraction);
        CubicCurve2D value = (CubicCurve2D)v0.clone();
        value.setCurve(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2);
        return value;
    }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

          break;
        case PathIterator.SEG_LINETO:
          GLPanel.V(gl, f[0], f[1]);
          break;
        case PathIterator.SEG_CUBICTO:
        CubicCurve2D c = new CubicCurve2D.Float(lastMoveTo[0], lastMoveTo[1],
            f[0], f[1], f[2], f[3], f[4], f[5]);
        drawShape(gl, c);
          break;
        default:
          throw new Error("Error while drawing AWT shape. "
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

        int d = 100;
        int dist = (int) point1.distance(point2);
        if (dist < d) {
            d = dist;
        }
        CubicCurve2D line = new CubicCurve2D.Double(point1.x, point1.y,
                point1.x + d, point1.y, point2.x - d, point2.y, point2.x,
                point2.y);
        g.draw(line);
    }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

        int d = 100;
        int dist = (int) point1.distance(point2);
        if (dist < d) {
            d = dist;
        }
        CubicCurve2D line = new CubicCurve2D.Double(point1.x, point1.y, point1.x + d, point1.y, point2.x - d, point2.y,
                point2.x, point2.y);
        g.draw(line);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.