|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.geom.RectangularShape
java.awt.geom.Ellipse2D
view.MyEllipse
public class MyEllipse
An {link Ellipse2D} object that allows construction with a string.
Additionally we supply methods to determine distances from the ellipse
border. Basically this is an Ellipse2D.Double object, but we do not
extend this because we want different constructors that might otherwise
lure the user in the wrtong direction.
| Nested Class Summary | |
|---|---|
static class |
MyEllipse.Test
Test the various routines. |
| Nested classes/interfaces inherited from class java.awt.geom.Ellipse2D |
|---|
Ellipse2D.Double, Ellipse2D.Float |
| Field Summary | |
|---|---|
private double |
height
The height or twice the minor axis of the ellipse. |
private double |
width
The width or twice the major axis of the ellipse. |
private double |
x
The upper left corner of the ellipse, x-coordinate. |
private double |
y
The upper left corner of the ellipse, y-coordinate. |
| Constructor Summary | |
|---|---|
MyEllipse(Point2D center,
double a,
double b)
We also support a constructor with the center of the ellipse and the length of the major and minor axis. |
|
MyEllipse(String s)
Construction via a string of format |
|
| Method Summary | |
|---|---|
static double |
getBearing(Ellipse2D ellipse,
Point2D p)
Returns the angle between the center of this ellipse and the point p. |
double |
getBearing(Point2D p)
Returns the angle between the center of this ellipse and the point p. |
Rectangle2D |
getBounds2D()
Returns the bounding box of this ellipse. |
double |
getHeight()
Returns the height or twice the minor axis of the ellipse. |
static double |
getPerimeterDistance(Ellipse2D ellipse,
Point2D p)
Returns the distance of this point to the outer edge of the ellipse. |
double |
getPerimeterDistance(Point2D p)
Returns the distance of this point to the outer edge of the ellipse. |
Point2D |
getPerimeterPoint(double angle)
Returns the point on the perimeter from the center of the ellipse with a polar angle in radian as specified. |
static Point2D |
getPerimeterPoint(Ellipse2D ellipse,
double angle)
Returns the point on the perimeter from the center of the ellipse with a polar angle in radian as specified. |
double |
getWidth()
Returns the width or twice the major axis of the ellipse. |
double |
getX()
The upper left corner, x coordinate. |
double |
getY()
The upper left corner, x coordinate. |
boolean |
isEmpty()
True if we have no extend on our bounding box. |
void |
setFrame(double xc,
double yc,
double w,
double h)
Sets the bounding frame of this ellipse which is determines the location and size of this Ellipse2D object. |
String |
toString()
Returns a constructor-compliant description of this ellipse. |
static String |
toString(Ellipse2D parse)
Converts any ellipse2d into a string that is parsable with this class's constructor. |
| Methods inherited from class java.awt.geom.Ellipse2D |
|---|
contains, contains, equals, getPathIterator, hashCode, intersects |
| Methods inherited from class java.awt.geom.RectangularShape |
|---|
clone, contains, contains, getBounds, getCenterX, getCenterY, getFrame, getMaxX, getMaxY, getMinX, getMinY, getPathIterator, intersects, setFrame, setFrame, setFrameFromCenter, setFrameFromCenter, setFrameFromDiagonal, setFrameFromDiagonal |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
private double x
private double y
private double width
private double height
| Constructor Detail |
|---|
public MyEllipse(String s)
x,y;w,h
where x and y are the coordinates of the upper left corner of this
ellipse, and w and h the width and height.
public MyEllipse(Point2D center,
double a,
double b)
| Method Detail |
|---|
public double getX()
getX in class RectangularShapepublic double getY()
getY in class RectangularShapepublic double getWidth()
getWidth in class RectangularShapepublic double getHeight()
getHeight in class RectangularShapepublic boolean isEmpty()
isEmpty in class RectangularShape
public void setFrame(double xc,
double yc,
double w,
double h)
Ellipse2D object.
setFrame in class RectangularShapex, y - the coordinates to which to set
upper left corner of this ellipse.w - the new width of the ellipse.h - the new height of the ellipse.public Rectangle2D getBounds2D()
public double getPerimeterDistance(Point2D p)
public static double getPerimeterDistance(Ellipse2D ellipse,
Point2D p)
public Point2D getPerimeterPoint(double angle)
public static Point2D getPerimeterPoint(Ellipse2D ellipse,
double angle)
public double getBearing(Point2D p)
public static double getBearing(Ellipse2D ellipse,
Point2D p)
public String toString()
toString in class Objectpublic static String toString(Ellipse2D parse)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||