Examples of CubicCurve2D


Examples of java.awt.geom.CubicCurve2D

        CONTROL_POINT_SIZE, CONTROL_POINT_SIZE);
    return outer;
  }

  private void paintSpline(Graphics2D g2) {
    CubicCurve2D spline = new CubicCurve2D.Double(xPositionToPixel(0.0), yPositionToPixel(0.0),
        xPositionToPixel(control1.getX()),
        yPositionToPixel(control1.getY()),
        xPositionToPixel(control2.getX()),
        yPositionToPixel(control2.getY()),
        xPositionToPixel(1.0), yPositionToPixel(1.0));
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

    return true;
  }
 
  public JComponent getSettingsView( RenderContext context )
  {
    final CubicCurve2D basicShape = new CubicCurve2D.Double(
      0.0, isFadeIn ? 0.0 : 1.0, 0.5, 0.5, 0.5, 0.5, 1.0, isFadeIn ? 1.0 : 0.0 );
    final JPanel p = new JPanel( new BorderLayout() );
 
    curvePanel = new CurvePanel( new CubicCurve2D[] { basicShape }, prefs );
    curvePanel.setPreferredSize( new Dimension( 162, 162 ));
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  }


  private void test_array(TestHarness harness)
  {
    CubicCurve2D curve;

    harness.checkPoint("array");

    curve = new CubicCurve2D.Double();
    curve.setCurve(new double[] { 1, 2, 3, 11, 12, 13, 14, 15, 16, 17, 18 },
                   /* offset */ 3);
    harness.check(curve.getX1(), 11);     // Check 1
    harness.check(curve.getY1(), 12);     // Check 2
    harness.check(curve.getCtrlX1(), 13); // Check 3
    harness.check(curve.getCtrlY1(), 14); // Check 4
    harness.check(curve.getCtrlX2(), 15); // Check 5
    harness.check(curve.getCtrlY2(), 16); // Check 6
    harness.check(curve.getX2(), 17);     // Check 7
    harness.check(curve.getY2(), 18);     // Check 8
  }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  }


  private void test_fourPoints(TestHarness harness)
  {
    CubicCurve2D curve;

    harness.checkPoint("fourPoints");

    curve = new CubicCurve2D.Double();
    curve.setCurve(new Point2D.Float(1, 2),
                   new Point2D.Double(3, 4),
                   new Point(5, 6),
                   new Point2D.Float(7, 8));

    harness.check(curve.getX1(), 1);     // Check 1
    harness.check(curve.getY1(), 2);     // Check 2
    harness.check(curve.getCtrlX1(), 3); // Check 3
    harness.check(curve.getCtrlY1(), 4); // Check 4
    harness.check(curve.getCtrlX2(), 5); // Check 5
    harness.check(curve.getCtrlY2(), 6); // Check 6
    harness.check(curve.getX2(), 7);     // Check 7
    harness.check(curve.getY2(), 8);     // Check 8
  }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  }


  private void test_CubicCurve2D(TestHarness harness)
  {
    CubicCurve2D curve;
    Point2D[] pts = new Point2D[20];

    harness.checkPoint("CubicCurve2D");

    curve = new CubicCurve2D.Float();
    curve.setCurve(new CubicCurve2D.Double(9, 8, 7, 6, 5, 4, 3, 2));

    harness.check(curve.getX1(), 9);     // Check 1
    harness.check(curve.getY1(), 8);     // Check 2
    harness.check(curve.getCtrlX1(), 7); // Check 3
    harness.check(curve.getCtrlY1(), 6); // Check 4
    harness.check(curve.getCtrlX2(), 5); // Check 5
    harness.check(curve.getCtrlY2(), 4); // Check 6
    harness.check(curve.getX2(), 3);     // Check 7
    harness.check(curve.getY2(), 2);     // Check 8

    curve = new CubicCurve2D.Double();
    curve.setCurve(new CubicCurve2D.Float(90, 80, 70, 60, 50, 40, 30, 20));

    harness.check(curve.getX1(), 90);     // Check 9
    harness.check(curve.getY1(), 80);     // Check 10
    harness.check(curve.getCtrlX1(), 70); // Check 11
    harness.check(curve.getCtrlY1(), 60); // Check 12
    harness.check(curve.getCtrlX2(), 50); // Check 13
    harness.check(curve.getCtrlY2(), 40); // Check 14
    harness.check(curve.getX2(), 30);     // Check 15
    harness.check(curve.getY2(), 20);     // Check 16
  }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  }


  private void test_curve2()
  {
    CubicCurve2D src, left, right;

    harness.checkPoint("curve2");
    src = new CubicCurve2D.Double(42, 24, 123, 321, -78011, -11087, 41, 28);
    left = new CubicCurve2D.Double();
    right = new CubicCurve2D.Float();
    src.subdivide(left, right);
    chkeps(left.getX1(), 42);            // 1
    chkeps(left.getY1(), 24);            // 2
    chkeps(left.getCtrlX1(), 82.5);      // 3
    chkeps(left.getCtrlY1(), 172.5);     // 4
    chkeps(left.getCtrlX2(), -19430.75); // 5
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

  }


  private void test_curve3()
  {
    CubicCurve2D src, left, right;

    harness.checkPoint("curve3");
    src = new CubicCurve2D.Double(23, -23, 42, -42, 1968.5, -1968.5, 68, 96);
    left = new CubicCurve2D.Float();
    right = new CubicCurve2D.Float();
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

      for (Tree child : getTree().getChildren(parent)) {
        Rectangle2D.Double childBounds = getBoundsOfNode(child);
        double x2 = childBounds.getCenterX();
        double y2 = childBounds.getMinY();
        if (getUseCurvedEdges()) {
          CubicCurve2D c = new CubicCurve2D.Double();
          double ctrlx1 = x1;
          double ctrly1 = (y1+y2)/2;
          double ctrlx2 = x2;
          double ctrly2 = y1;
          c.setCurve(x1, y1, ctrlx1, ctrly1, ctrlx2, ctrly2, x2, y2);
          ((Graphics2D) g).draw(c);
        } else {
          g.drawLine((int) x1, (int) y1,
                 (int) x2, (int) y2);
        }
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

                               double cx1, double cy1,
                               double cx2, double cy2,
                               double x2, double y2,
                               double[] data)
  {
    CubicCurve2D curve;
    FlatteningPathIterator fpi;

    curve = new CubicCurve2D.Double(x1, y1, cx1, cy1, cx2, cy2, x2, y2);
    fpi = new FlatteningPathIterator(curve.getPathIterator(null),
                                     flatness, level);
    if (data == null)
    {
      dump(fpi);
      /*
 
View Full Code Here

Examples of java.awt.geom.CubicCurve2D

public class clone
  implements Testlet
{
  public void test(TestHarness harness)
  {
    CubicCurve2D curve;

    // Checks 1 to 7: Clone a CubicCurve2D.Double
    curve = (CubicCurve2D) (new CubicCurve2D.Double(4,3,9,1,7,8,2,6)).clone();
    harness.check(curve instanceof CubicCurve2D.Double); // 1
    harness.check(curve.getX1(), 4.0);                   // 2
    harness.check(curve.getY1(), 3.0);                   // 3
    harness.check(curve.getCtrlX1(), 9.0);               // 4
    harness.check(curve.getCtrlY1(), 1.0);               // 5
    harness.check(curve.getCtrlX2(), 7.0);               // 6
    harness.check(curve.getCtrlY2(), 8.0);               // 7
    harness.check(curve.getX2(), 2.0);                   // 8
    harness.check(curve.getY2(), 6.0);                   // 9

    // Checks 8 to 14: Clone a CubicCurve2D.Float
    curve = (CubicCurve2D) (new CubicCurve2D.Float(-4,3,-9,1,7,-8,-2,-6))
      .clone();
    harness.check(curve instanceof CubicCurve2D.Float)// 10
    harness.check(curve.getX1(), -4.0);                  // 11
    harness.check(curve.getY1(), 3.0);                   // 12
    harness.check(curve.getCtrlX1(), -9.0);              // 13
    harness.check(curve.getCtrlY1(), 1.0);               // 14
    harness.check(curve.getCtrlX2(), 7.0);               // 15
    harness.check(curve.getCtrlY2(), -8.0);              // 16
    harness.check(curve.getX2(), -2.0);                  // 17
    harness.check(curve.getY2(), -6.0);                  // 18
  }
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.