|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectmath.geom2d.curve.AbstractContinuousCurve2D
math.geom2d.curve.AbstractSmoothCurve2D
math.geom2d.conic.Ellipse2D
public class Ellipse2D
An ellipse in the plane. It is defined by the center, the orientation angle, and the lengths of the two axis. No convention is taken about lengths of semiaxis: the second semi axis can be greater than the first one.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface math.geom2d.conic.Conic2D |
|---|
Conic2D.Type |
| Field Summary |
|---|
| Fields inherited from interface math.geom2d.Shape2D |
|---|
ACCURACY |
| Constructor Summary | |
|---|---|
Ellipse2D()
Empty constructor, define ellipse centered at origin with both major and minor semi-axis with length equal to 1. |
|
Ellipse2D(double xc,
double yc,
double l1,
double l2)
Define center by coordinate, plus major and minor semi axis |
|
Ellipse2D(double xc,
double yc,
double l1,
double l2,
double theta)
Define center by coordinate, major and minor semi axis lengths, and orientation angle. |
|
Ellipse2D(double xc,
double yc,
double l1,
double l2,
double theta,
boolean direct)
Define center by coordinate, major and minor semi axis lengths, orientation angle, and boolean flag for directed ellipse. |
|
Ellipse2D(java.awt.geom.Ellipse2D ellipse)
construct an ellipse from the java.awt.geom class for ellipse. |
|
Ellipse2D(Point2D center,
double l1,
double l2)
Main constructor: define center by a point plus major and minor semi axis |
|
Ellipse2D(Point2D center,
double l1,
double l2,
double theta)
Define center by point, major and minor semi axis lengths, and orientation angle. |
|
| Method Summary | |
|---|---|
boolean |
almostEquals(GeometricObject2D obj,
double eps)
Checks if the two objects are similar up to a given threshold value. |
double |
angle()
Returns the angle of the ellipse first axis with the Ox axis. |
java.awt.geom.GeneralPath |
appendPath(java.awt.geom.GeneralPath path)
Add the path of the ellipse to the given path. |
LinearRing2D |
asPolyline(int n)
Converts this continuous curve to an instance of LinearCurve2D with the given number of edges. |
Box2D |
boundingBox()
Return more precise bounds for the ellipse. |
Point2D |
center()
Returns center of the ellipse. |
CurveSet2D<? extends SmoothOrientedCurve2D> |
clip(Box2D box)
Clip the ellipse by a box. |
Ellipse2D |
clone()
Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D. |
double[] |
conicCoefficients()
Returns the conic coefficients of the ellipse. |
Conic2D.Type |
conicType()
|
boolean |
contains(double x,
double y)
Returns true if the point (x, y) lies on the ellipse, with precision given by Shape2D.ACCURACY. |
boolean |
contains(Point2D p)
Returns true if the point p lies on the ellipse, with precision given by Shape2D.ACCURACY. |
java.util.Collection<? extends Ellipse2D> |
continuousCurves()
Returns the collection of continuous curves which constitute this curve. |
static Ellipse2D |
create(java.awt.geom.Ellipse2D ellipse)
Deprecated. since 0.11.1 |
static Ellipse2D |
create(Point2D center,
double l1,
double l2)
Deprecated. since 0.11.1 |
static Ellipse2D |
create(Point2D center,
double l1,
double l2,
double theta)
Deprecated. since 0.11.1 |
static Ellipse2D |
create(Point2D center,
double l1,
double l2,
double theta,
boolean direct)
Define center by point, major and minor semi axis lengths, orientation angle, and boolean flag for direct ellipse. |
static Ellipse2D |
create(Point2D focus1,
Point2D focus2,
double chord)
Create a new Ellipse by specifying the two focii, and the length of the chord. |
double |
curvature(double t)
Returns the curvature of the ellipse. |
double |
distance(double x,
double y)
Returns the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. fillable) shape. |
double |
distance(Point2D point)
Computes distance using a polyline approximation. |
Domain2D |
domain()
Returns the domain delimited by this boundary. |
void |
draw(java.awt.Graphics2D g2)
Draws the curve on the given Graphics2D object. |
double |
eccentricity()
Computes eccentricity of ellipse, depending on the lengths of the semi-axes. |
boolean |
equals(java.lang.Object obj)
|
void |
fill(java.awt.Graphics2D g2)
Fills the interior of the boundary, using the Graphics current Paint. |
Point2D |
firstPoint()
Returns the first point of the ellipse, which is the same as the last point. |
Point2D |
focus1()
Return the first focus. |
Point2D |
focus2()
Returns the second focus. |
java.awt.geom.GeneralPath |
getGeneralPath()
|
double |
getRho(double angle)
Return the RHO parameter, in a polar representation of the ellipse, centered at the center of ellipse. |
double |
getT0()
Deprecated. replaced by t0() (since 0.11.1). |
double |
getT1()
Deprecated. replaced by t1() (since 0.11.1). |
java.util.Collection<Point2D> |
intersections(LinearShape2D line)
Compute intersections of the ellipse with a straight object (line, line segment, ray...). |
boolean |
isBounded()
Always returns true. |
boolean |
isCircle()
Returns true if this ellipse is similar to a circle, i.e. has same length for both r1 and r2. |
boolean |
isClosed()
Returns true, as an ellipse is always closed. |
boolean |
isDirect()
Returns true if ellipse has a direct orientation. |
boolean |
isEmpty()
Always returns false. |
boolean |
isInside(Point2D point)
Test whether the point is inside the ellipse. |
Point2D |
lastPoint()
Returns the last point of the ellipse, which is the same as the first point. |
Ellipse2D |
parallel(double d)
Return the parallel ellipse located at a distance d from this ellipse. |
Point2D |
point(double t)
get the position of the curve from internal parametric representation, depending on the parameter t. |
double |
position(Point2D point)
Computes the position of the point on the curve. |
double |
project(Point2D point)
Computes the approximate projection position of the point on the ellipse. |
Point2D |
projectedPoint(Point2D point)
|
Vector2D |
projectedVector(Point2D point,
double eMax)
Compute projection of a point onto an ellipse. |
static Ellipse2D |
reduceCentered(double[] coefs)
Creates a new Ellipse by reducing the conic coefficients, assuming conic type is ellipse, and ellipse is centered. |
Ellipse2D |
reverse()
Returns the ellipse with same center and same radius, but with the other orientation. |
double |
semiMajorAxisLength()
Returns the length of the major semi-axis of the ellipse. |
double |
semiMinorAxisLength()
Returns the length of the minor semi-axis of the ellipse. |
double |
signedDistance(double x,
double y)
The same as distanceSigned(Point2D), but by passing 2 double as arguments. |
double |
signedDistance(Point2D point)
Returns an approximation of the signed distance to the ellipse. |
EllipseArc2D |
subCurve(double t0,
double t1)
return a new EllipseArc2D. |
double |
t0()
Returns the parameter of the first point of the ellipse, set to 0. |
double |
t1()
Returns the parameter of the last point of the ellipse, set to 2*PI. |
Vector2D |
tangent(double t)
Returns the tangent of the curve at the given position. |
java.lang.String |
toString()
|
Ellipse2D |
transform(AffineTransform2D trans)
Transforms this ellipse by an affine transform. |
static Ellipse2D |
transformCentered(Ellipse2D ellipse,
AffineTransform2D trans)
Transform an ellipse, by supposing both the ellipse is centered and the transform has no translation part. |
Vector2D |
vector1()
Returns the first direction vector of the ellipse, in the direction of the major axis. |
Vector2D |
vector2()
Returns the second direction vector of the ellipse, in the direction of the minor axis. |
double |
windingAngle(Point2D point)
Return either 0, 2*PI or -2*PI, depending whether the point is located inside the interior of the ellipse or not. |
| Methods inherited from class math.geom2d.curve.AbstractSmoothCurve2D |
|---|
isSingular, leftTangent, normal, rightTangent, singularPoints, smoothPieces, vertices |
| Methods inherited from class math.geom2d.curve.AbstractContinuousCurve2D |
|---|
asAwtShape |
| Methods inherited from class java.lang.Object |
|---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface math.geom2d.curve.SmoothCurve2D |
|---|
normal |
| Methods inherited from interface math.geom2d.curve.ContinuousCurve2D |
|---|
leftTangent, rightTangent, smoothPieces |
| Methods inherited from interface math.geom2d.curve.Curve2D |
|---|
asAwtShape, isSingular, singularPoints, vertices |
| Constructor Detail |
|---|
public Ellipse2D()
public Ellipse2D(Point2D center,
double l1,
double l2)
public Ellipse2D(double xc,
double yc,
double l1,
double l2)
public Ellipse2D(Point2D center,
double l1,
double l2,
double theta)
public Ellipse2D(double xc,
double yc,
double l1,
double l2,
double theta)
public Ellipse2D(double xc,
double yc,
double l1,
double l2,
double theta,
boolean direct)
public Ellipse2D(java.awt.geom.Ellipse2D ellipse)
| Method Detail |
|---|
public static Ellipse2D create(Point2D focus1,
Point2D focus2,
double chord)
focus1 - the first focusfocus2 - the second focuschord - the sum of distances to focii
@Deprecated
public static Ellipse2D create(Point2D center,
double l1,
double l2)
@Deprecated
public static Ellipse2D create(Point2D center,
double l1,
double l2,
double theta)
public static Ellipse2D create(Point2D center,
double l1,
double l2,
double theta,
boolean direct)
@Deprecated public static Ellipse2D create(java.awt.geom.Ellipse2D ellipse)
public static Ellipse2D reduceCentered(double[] coefs)
coefs - an array of double with at least 3 coefficients containing
coefficients for x^2, xy, and y^2 factors.
public static Ellipse2D transformCentered(Ellipse2D ellipse,
AffineTransform2D trans)
ellipse - an ellipsetrans - an affine transform
public double getRho(double angle)
angle - : angle from horizontal
public Point2D projectedPoint(Point2D point)
public Vector2D projectedVector(Point2D point,
double eMax)
point to its
projection on the ellipse, with the direction parallel to the local
normal to the ellipse. The parameter rho of the
PolarVector2D is positive if point lies
Refs :
http://www.spaceroots.org/documents/distance/distance-to-ellipse.pdf,
http://www.spaceroots.org/downloads.html
- Parameters:
point - eMax -
- Returns:
- the projection vector
public Ellipse2D parallel(double d)
public boolean isDirect()
isDirect in interface EllipseShape2Dpublic boolean isCircle()
isCircle in interface EllipseShape2Dpublic double semiMajorAxisLength()
public double semiMinorAxisLength()
public Point2D center()
center in interface EllipseShape2Dpublic Point2D focus1()
public Point2D focus2()
public Vector2D vector1()
public Vector2D vector2()
public double angle()
public Conic2D.Type conicType()
conicType in interface Conic2Dpublic double[] conicCoefficients()
conicCoefficients in interface Conic2Dpublic double eccentricity()
eccentricity in interface Conic2Dpublic Domain2D domain()
Boundary2D
domain in interface Boundary2Dpublic void fill(java.awt.Graphics2D g2)
Boundary2D
fill in interface Boundary2Dg2 - the Graphics to fill onpublic double windingAngle(Point2D point)
windingAngle in interface OrientedCurve2Dpoint - a point of the plane
public boolean isInside(Point2D point)
isInside in interface Boundary2DisInside in interface OrientedCurve2Dpoint - a point in the plane
public double signedDistance(Point2D point)
signedDistance in interface OrientedCurve2Dpoint - a point of the plane
public double signedDistance(double x,
double y)
OrientedCurve2D
signedDistance in interface OrientedCurve2Dx - x-coord of a pointy - y-coord of a point
public Vector2D tangent(double t)
SmoothCurve2D
tangent in interface SmoothCurve2Dt - a position on the curve
SmoothCurve2D.normal(double)public double curvature(double t)
curvature in interface ContinuousCurve2Dt - the position on the curve
public boolean isClosed()
isClosed in interface ContinuousCurve2Dpublic LinearRing2D asPolyline(int n)
AbstractContinuousCurve2D
asPolyline in interface ContinuousCurve2DasPolyline in class AbstractContinuousCurve2Dn - the number of line segments
n line segments.ContinuousCurve2D.asPolyline(int)public boolean isBounded()
isBounded in interface Shape2Dpublic boolean isEmpty()
isEmpty in interface Shape2Dpublic double t0()
t0 in interface Curve2D@Deprecated public double getT0()
getT0 in interface Curve2Dpublic double t1()
t1 in interface Curve2D@Deprecated public double getT1()
getT1 in interface Curve2Dpublic Point2D point(double t)
point in interface Curve2Dpublic Point2D firstPoint()
firstPoint in interface Curve2DfirstPoint in class AbstractContinuousCurve2DCurve2D.t0(),
Curve2D.point(double)public Point2D lastPoint()
lastPoint in interface Curve2DlastPoint in class AbstractContinuousCurve2DCurve2D.t1(),
Curve2D.point(double)public double position(Point2D point)
Curve2Dpoint(double) method.
position in interface Curve2Dpoint - a point belonging to the curve
Curve2D.point(double)public double project(Point2D point)
project in interface Curve2Dpoint - a point to project
public Ellipse2D reverse()
reverse in interface Conic2Dreverse in interface EllipseShape2Dreverse in interface ContinuousCurve2Dreverse in interface Curve2Dreverse in interface SmoothCurve2Dreverse in interface Boundary2Dreverse in interface ContinuousOrientedCurve2Dreverse in interface Contour2Dreverse in interface OrientedCurve2Dreverse in interface SmoothContour2Dreverse in interface SmoothOrientedCurve2Dpublic java.util.Collection<? extends Ellipse2D> continuousCurves()
Curve2D
continuousCurves in interface EllipseShape2DcontinuousCurves in interface Curve2DcontinuousCurves in interface Boundary2DcontinuousCurves in class AbstractContinuousCurve2D
public EllipseArc2D subCurve(double t0,
double t1)
subCurve in interface ContinuousCurve2DsubCurve in interface Curve2DsubCurve in interface SmoothCurve2DsubCurve in interface ContinuousOrientedCurve2DsubCurve in interface SmoothOrientedCurve2Dt0 - position of the start of the sub-curvet1 - position of the end of the sub-curve
public double distance(Point2D point)
distance in interface Shape2D
public double distance(double x,
double y)
Shape2D
distance in interface Shape2Dpublic CurveSet2D<? extends SmoothOrientedCurve2D> clip(Box2D box)
clip in interface Conic2Dclip in interface ContinuousCurve2Dclip in interface Curve2Dclip in interface SmoothCurve2Dclip in interface ContinuousOrientedCurve2Dclip in interface OrientedCurve2Dclip in interface SmoothOrientedCurve2Dclip in interface Shape2Dbox - the clipping box
public Box2D boundingBox()
boundingBox in interface Shape2Dpublic java.util.Collection<Point2D> intersections(LinearShape2D line)
Principle of the algorithm is to transform line and ellipse such that ellipse becomes a circle, then using the intersections computation from circle.
intersections in interface Curve2Dpublic Ellipse2D transform(AffineTransform2D trans)
transform in interface Conic2Dtransform in interface EllipseShape2Dtransform in interface ContinuousCurve2Dtransform in interface Curve2Dtransform in interface SmoothCurve2Dtransform in interface Boundary2Dtransform in interface ContinuousOrientedCurve2Dtransform in interface Contour2Dtransform in interface OrientedCurve2Dtransform in interface SmoothContour2Dtransform in interface SmoothOrientedCurve2Dtransform in interface Shape2Dtrans - an affine transform
public boolean contains(Point2D p)
contains in interface Shape2D
public boolean contains(double x,
double y)
contains in interface Shape2Dpublic java.awt.geom.GeneralPath getGeneralPath()
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
appendPath in interface ContinuousCurve2Dpath - the path to be completed
public void draw(java.awt.Graphics2D g2)
Curve2D
draw in interface Curve2Ddraw in interface Shape2Ddraw in class AbstractContinuousCurve2Dg2 - the graphics to draw the curve in
public boolean almostEquals(GeometricObject2D obj,
double eps)
GeometricObject2D
almostEquals in interface GeometricObject2Dobj - the object to compareeps - a threshold value, for example the minimal coordinate difference
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic Ellipse2D clone()
Curve2D
clone in interface Curve2Dclone in class AbstractSmoothCurve2Dpublic java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||