Examples of Arc2D


Examples of java.awt.geom.Arc2D

            // arc and ask for it's end angle and get the tangent there.
            Point2D prevEndPoint =
                getSegmentTerminatingPoint(prev, prevSegType);
            boolean large   = (curr[3]!=0.);
            boolean goLeft = (curr[4]!=0.);
            Arc2D arc = ExtendedGeneralPath.computeArc
                (prevEndPoint.getX(), prevEndPoint.getY(),
                 curr[0], curr[1], curr[2],
                 large, goLeft, curr[5], curr[6]);
            double theta = arc.getAngleStart()+arc.getAngleExtent();
            theta = Math.toRadians(theta);
            dx = -arc.getWidth()/2.0*Math.sin(theta);
            dy = arc.getHeight()/2.0*Math.cos(theta);

            // System.out.println("In  Theta:  " + Math.toDegrees(theta) + 
            //                    " Dx/Dy: " + dx + "/" + dy);
            if (curr[2] != 0) {
                double ang = Math.toRadians(-curr[2]);
View Full Code Here

Examples of java.awt.geom.Arc2D

        case ExtendedPathIterator.SEG_ARCTO: {
            // If the current segment is an ARCTO then we build the
            // arc and ask for it's end angle and get the tangent there.
            boolean large   = (next[3]!=0.);
            boolean goLeft = (next[4]!=0.);
            Arc2D arc = ExtendedGeneralPath.computeArc
                (currEndPoint.getX(), currEndPoint.getY(),
                 next[0], next[1], next[2],
                 large, goLeft, next[5], next[6]);
            double theta = arc.getAngleStart();
            theta = Math.toRadians(theta);
            dx = -arc.getWidth()/2.0*Math.sin(theta);
            dy = arc.getHeight()/2.0*Math.cos(theta);
            // System.out.println("Out Theta:  " + Math.toDegrees(theta) + 
            //                    " Dx/Dy: " + dx + "/" + dy);
            if (next[2] != 0) {
                double ang = Math.toRadians(-next[2]);
                double sinA = Math.sin(ang);
View Full Code Here

Examples of java.awt.geom.Arc2D

     *                    relative to the start angle.
     * @see         java.awt.Graphics#fillArc
     */
    public void drawArc(int x, int y, int width, int height,
                        int startAngle, int arcAngle){
        Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.OPEN);
        draw(arc);
    }
View Full Code Here

Examples of java.awt.geom.Arc2D

     *                    relative to the start angle.
     * @see         java.awt.Graphics#drawArc
     */
    public void fillArc(int x, int y, int width, int height,
                        int startAngle, int arcAngle){
        Arc2D arc = new Arc2D.Float(x, y, width, height, startAngle, arcAngle, Arc2D.PIE);
        fill(arc);
    }
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    Arc2D arc = new Arc2D.Double();
    Rectangle2D b = arc.getBounds2D();
    harness.check(b.getX(), 0.0);
    harness.check(b.getY(), 0.0);
    harness.check(b.getWidth(), 0.0);
    harness.check(b.getHeight(), 0.0);
 
    arc = new Arc2D.Double(
      new Rectangle2D.Double(0.0, 0.0, 1.0, 1.0), 90, 90, Arc2D.PIE
    );
    b = arc.getBounds2D();
    harness.check(b.getX(), 0.0);
    harness.check(b.getY(), 0.0);
    harness.check(b.getWidth(), 0.5);
    harness.check(b.getHeight(), 0.5);
  }
View Full Code Here

Examples of java.awt.geom.Arc2D

   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    // setAngleStart(double)
    Arc2D arc = new Arc2D.Double(0.0, 0.0, 1.0, 1.0, 0.0, 90.0, Arc2D.PIE);
    arc.setAngleStart(85.0);
    harness.check(arc.getAngleStart(), 85.0);
   
    // setAngleStart(Point2D)
    arc.setAngleStart(new Point2D.Double(1.0, 1.0));
    harness.check(arc.getAngleStart(), -45.0);
    boolean pass = false;
    try
    {
      arc.setAngleStart(null);
    }
    catch (NullPointerException e)
    {
      pass = true;
    }
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    Arc2D arc = new Arc2D.Double();
    harness.check(!arc.intersects(0.0, 0.0, 0.0, 0.0));
    harness.check(!arc.intersects(1.0, 2.0, 3.0, 4.0));

    arc = new Arc2D.Double(-1.0, -1.0, 2.0, 2.0, 0.0, 90.0, Arc2D.PIE);
    harness.check(arc.intersects(-1.0, 0.0, 1.0, 1.0));
    harness.check(arc.intersects(-1.0, -1.0, 1.0, 1.0));
    harness.check(arc.intersects(0.0, 0.0, 1.0, 1.0));
    harness.check(arc.intersects(0.0, -1.0, 1.0, 1.0));
    harness.check(!arc.intersects(5.0, 5.0, 1.0, 1.0));
   
    arc = new Arc2D.Double();
    harness.check(!arc.intersects(new Rectangle2D.Double(0.0, 0.0, 0.0, 0.0)));
    boolean pass = false;
    try {
        arc.intersects(null);
    }
    catch (NullPointerException e) {
        pass = true;
    }
    harness.check(pass);
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)     
  {
    Arc2D arc = new Arc2D.Double();
    arc.setArcType(Arc2D.OPEN);
    harness.check(arc.getArcType() == Arc2D.OPEN);
    arc.setArcType(Arc2D.CHORD);
    harness.check(arc.getArcType() == Arc2D.CHORD);
    arc.setArcType(Arc2D.PIE);
    harness.check(arc.getArcType() == Arc2D.PIE);
   
    boolean pass = false;
    try {
      arc.setArcType(99);
    }
    catch (IllegalArgumentException e) {
      pass = true;
    }
    harness.check(pass);
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)      
  {
    Arc2D arc = new Arc2D.Double(0.0, 0.0, 1.0, 1.0, 0.0, 90.0, Arc2D.PIE);
    arc.setFrame(1.0, 2.0, 3.0, 4.0);
    harness.check(arc.getX(), 1.0);
    harness.check(arc.getY(), 2.0);
    harness.check(arc.getWidth(), 3.0);
    harness.check(arc.getHeight(), 4.0);
  }
View Full Code Here

Examples of java.awt.geom.Arc2D

   *
   * @param harness  the test harness (<code>null</code> not permitted).
   */
  public void test(TestHarness harness)
  {
    Arc2D arc1 = new Arc2D.Float(1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, Arc2D.PIE);
    Arc2D arc2 = null;
    arc2 = (Arc2D) arc1.clone();
    harness.check(arc1.getX() == arc2.getX());
    harness.check(arc1.getY() == arc2.getY());
    harness.check(arc1.getWidth() == arc2.getWidth());
    harness.check(arc1.getHeight() == arc2.getHeight());
    harness.check(arc1.getAngleStart(), arc2.getAngleStart());
    harness.check(arc1.getAngleExtent(), arc2.getAngleExtent());
    harness.check(arc1.getArcType() == arc2.getArcType());
    harness.check(arc1.getClass() == arc2.getClass());
    harness.check(arc1 != arc2);
  }
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.