|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttoxi.geom.Vec2D
toxi.geom.Ellipse
public class Ellipse
This class defines a 2D ellipse and provides several utility methods for it.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class toxi.geom.Vec2D |
---|
Vec2D.Axis |
Field Summary |
---|
Fields inherited from class toxi.geom.Vec2D |
---|
MAX_VALUE, MIN_VALUE, x, X_AXIS, y, Y_AXIS, ZERO |
Constructor Summary | |
---|---|
Ellipse()
|
|
Ellipse(float rx,
float ry)
|
|
Ellipse(float x,
float y,
float r)
|
|
Ellipse(float x,
float y,
float rx,
float ry)
|
|
Ellipse(ReadonlyVec2D v,
float r)
|
|
Ellipse(ReadonlyVec2D v,
ReadonlyVec2D r)
|
Method Summary | |
---|---|
boolean |
containsPoint(ReadonlyVec2D p)
Checks if the point is within the given shape. |
float |
getArea()
Computes the area covered by the ellipse. |
float |
getCircumference()
Computes the approximate circumference of the ellipse, using this equation: 2 * PI * sqrt(1/2 * (rx*rx+ry*ry)) . |
Vec2D[] |
getFoci()
|
Vec2D |
getRadii()
|
Ellipse |
setRadii(float rx,
float ry)
Sets the radii of the ellipse to the new values. |
Ellipse |
setRadii(ReadonlyVec3D r)
Sets the radii of the ellipse to the values given by the vector. |
Polygon2D |
toPolygon2D(int res)
Creates a Polygon2D instance of the ellipse sampling it at the
given resolution. |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Ellipse()
public Ellipse(float rx, float ry)
public Ellipse(float x, float y, float r)
public Ellipse(float x, float y, float rx, float ry)
public Ellipse(ReadonlyVec2D v, float r)
public Ellipse(ReadonlyVec2D v, ReadonlyVec2D r)
Method Detail |
---|
public boolean containsPoint(ReadonlyVec2D p)
Shape2D
containsPoint
in interface Shape2D
public float getArea()
getArea
in interface Shape2D
public float getCircumference()
2 * PI * sqrt(1/2 * (rx*rx+ry*ry))
.
The precise value is an infinite series elliptical integral, but the
approximation comes sufficiently close. See Wikipedia for more details:
http://en.wikipedia.org/wiki/Ellipse
getCircumference
in interface Shape2D
public Vec2D[] getFoci()
public Vec2D getRadii()
public Ellipse setRadii(float rx, float ry)
rx
- ry
-
public Ellipse setRadii(ReadonlyVec3D r)
r
-
public Polygon2D toPolygon2D(int res)
Polygon2D
instance of the ellipse sampling it at the
given resolution.
res
- number of steps
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |