Ellipse2Dpublic abstract class Ellipse2D extends RectangularShape The Class Ellipse2D describes an ellipse defined by a rectangular area in
which it is inscribed. |
Constructors Summary |
---|
protected Ellipse2D()Instantiates a new Ellipse2D.
|
Methods Summary |
---|
public boolean | contains(double px, double py)
if (isEmpty()) {
return false;
}
double a = (px - getX()) / getWidth() - 0.5;
double b = (py - getY()) / getHeight() - 0.5;
return a * a + b * b < 0.25;
| public boolean | contains(double rx, double ry, double rw, double rh)
if (isEmpty() || rw <= 0.0 || rh <= 0.0) {
return false;
}
double rx1 = rx;
double ry1 = ry;
double rx2 = rx + rw;
double ry2 = ry + rh;
return contains(rx1, ry1) && contains(rx2, ry1) && contains(rx2, ry2) && contains(rx1, ry2);
| public java.awt.geom.PathIterator | getPathIterator(java.awt.geom.AffineTransform at)
return new Iterator(this, at);
| public boolean | intersects(double rx, double ry, double rw, double rh)
if (isEmpty() || rw <= 0.0 || rh <= 0.0) {
return false;
}
double cx = getX() + getWidth() / 2.0;
double cy = getY() + getHeight() / 2.0;
double rx1 = rx;
double ry1 = ry;
double rx2 = rx + rw;
double ry2 = ry + rh;
double nx = cx < rx1 ? rx1 : (cx > rx2 ? rx2 : cx);
double ny = cy < ry1 ? ry1 : (cy > ry2 ? ry2 : cy);
return contains(nx, ny);
|
|