toxi.geom
Class Ellipse
java.lang.Object
toxi.geom.Vec2D
toxi.geom.Ellipse
- All Implemented Interfaces:
- java.lang.Comparable<Vec2D>
- Direct Known Subclasses:
- Circle
public class Ellipse
- extends Vec2D
This class defines a 2D ellipse and provides several utility methods for it.
Methods inherited from class toxi.geom.Vec2D |
abs, add, add, addSelf, addSelf, angleBetween, angleBetween, clear, closestPointOnLine, closestPointOnTriangle, compareTo, constrain, constrain, copy, cross, distanceTo, distanceToSquared, dot, equals, equalsWithTolerance, floor, frac, fromTheta, getAbs, getComponent, getConstrained, getFloored, getFrac, getInverted, getLimited, getNormalized, getNormalizedTo, getPerpendicular, getReciprocal, getRotated, getSignum, hashCode, heading, interpolateTo, interpolateTo, interpolateToSelf, interpolateToSelf, intersectRayCircle, invert, isInCircle, isInRectangle, isInTriangle, isZeroVector, jitter, jitter, jitter, limit, magnitude, magSquared, max, max, maxSelf, min, min, minSelf, normalize, normalizeTo, perpendicular, pointInPolygon, randomVector, randomVector, reciprocal, rotate, scale, scale, scale, scaleSelf, scaleSelf, scaleSelf, set, set, setComponent, signum, sub, sub, subSelf, subSelf, tangentNormalOfEllipse, to3DXY, to3DXZ, to3DYZ, toArray, toCartesian, toPolar, toString |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
Ellipse
public Ellipse()
Ellipse
public Ellipse(float rx,
float ry)
Ellipse
public Ellipse(float x,
float y,
float r)
Ellipse
public Ellipse(float x,
float y,
float rx,
float ry)
Ellipse
public Ellipse(Vec2D v,
float r)
Ellipse
public Ellipse(Vec2D v,
Vec2D r)
containsPoint
public boolean containsPoint(Vec2D p)
getArea
public float getArea()
- Computes the area covered by the ellipse.
- Returns:
- area
getCircumference
public float getCircumference()
- Computes the approximate circumference of the ellipse, using this
equation:
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
- Returns:
- circumference
getFoci
public Vec2D[] getFoci()
- Returns:
- the focus
getRadii
public Vec2D getRadii()
- Returns:
- the 2 radii of the ellipse as a Vec2D
setRadii
public Ellipse setRadii(float rx,
float ry)
- Sets the radii of the ellipse to the new values.
- Parameters:
rx
- ry
-
- Returns:
- itself
setRadii
public Ellipse setRadii(Vec2D r)
- Sets the radii of the ellipse to the values given by the vector.
- Parameters:
r
-
- Returns:
- itself