/[classpath]/classpath/java/awt/geom/Arc2D.java
ViewVC logotype

Diff of /classpath/java/awt/geom/Arc2D.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by mkoch, Tue Nov 16 09:59:11 2004 UTC revision 1.10 by smarothy, Wed Nov 17 01:18:27 2004 UTC
# Line 327  public abstract class Arc2D extends Rect Line 327  public abstract class Arc2D extends Rect
327      // Normalize.      // Normalize.
328      double x = p.getX() - (getX() + getWidth() / 2);      double x = p.getX() - (getX() + getWidth() / 2);
329      double y = p.getY() - (getY() + getHeight() / 2);      double y = p.getY() - (getY() + getHeight() / 2);
330      setAngleStart(Math.toDegrees(Math.atan2(y, x)));      setAngleStart(Math.toDegrees(Math.atan2(-y, x)));
331    }    }
332    
333    /**    /**
# Line 352  public abstract class Arc2D extends Rect Line 352  public abstract class Arc2D extends Rect
352      y1 = y1 - (my + mh / 2);      y1 = y1 - (my + mh / 2);
353      x2 = x2 - (mx + mw / 2);      x2 = x2 - (mx + mw / 2);
354      y2 = y2 - (my + mh / 2);      y2 = y2 - (my + mh / 2);
355      double start = Math.toDegrees(Math.atan2(y1, x1));      double start = Math.toDegrees(Math.atan2(-y1, x1));
356      double extent = Math.toDegrees(Math.atan2(y2, x2)) - start;      double extent = Math.toDegrees(Math.atan2(-y2, x2)) - start;
357      if (extent < 0)      if (extent < 0)
358        extent += 360;        extent += 360;
359      setAngleStart(start);      setAngleStart(start);
# Line 469  public abstract class Arc2D extends Rect Line 469  public abstract class Arc2D extends Rect
469      double extent = getAngleExtent();      double extent = getAngleExtent();
470      double end = start + extent;      double end = start + extent;
471    
472        if (extent == 0)
473          return false;
474    
475      if (extent >= 360 || extent <= -360)      if (extent >= 360 || extent <= -360)
476        return true;        return true;
477    
# Line 490  public abstract class Arc2D extends Rect Line 493  public abstract class Arc2D extends Rect
493      while (a < start)      while (a < start)
494        a += 360;        a += 360;
495    
496      return a >= start && a <= end;      return a >= start && a < end; // starting angle included, ending angle not
497    }    }
498    
499    /**    /**
# Line 498  public abstract class Arc2D extends Rect Line 501  public abstract class Arc2D extends Rect
501     * is empty, then this will return false.     * is empty, then this will return false.
502     *     *
503     * The area considered 'inside' an arc of type OPEN is the same as the     * The area considered 'inside' an arc of type OPEN is the same as the
504     * area inside an equivalent filled PIE-type arc. The area considered     * area inside an equivalent filled CHORD-type arc. The area considered
505     * 'inside' a CHORD-type arc is the same as the filled area.     * 'inside' a CHORD-type arc is the same as the filled area.
506     *     *
507     * @param x the x coordinate to test     * @param x the x coordinate to test
# Line 521  public abstract class Arc2D extends Rect Line 524  public abstract class Arc2D extends Rect
524        return false;        return false;
525    
526      double angle = Math.toDegrees(Math.atan2(-dy, dx));      double angle = Math.toDegrees(Math.atan2(-dy, dx));
527      if (getArcType() != CHORD)      if (getArcType() == PIE)
528        return containsAngle(angle);        return containsAngle(angle);
529    
530      double a1 = Math.toRadians(getAngleStart());      double a1 = Math.toRadians(getAngleStart());

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26