|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object math.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 EllipseShape2D
public boolean isCircle()
isCircle
in interface EllipseShape2D
public double semiMajorAxisLength()
public double semiMinorAxisLength()
public Point2D center()
center
in interface EllipseShape2D
public Point2D focus1()
public Point2D focus2()
public Vector2D vector1()
public Vector2D vector2()
public double angle()
public Conic2D.Type conicType()
conicType
in interface Conic2D
public double[] conicCoefficients()
conicCoefficients
in interface Conic2D
public double eccentricity()
eccentricity
in interface Conic2D
public Domain2D domain()
Boundary2D
domain
in interface Boundary2D
public void fill(java.awt.Graphics2D g2)
Boundary2D
fill
in interface Boundary2D
g2
- the Graphics to fill onpublic double windingAngle(Point2D point)
windingAngle
in interface OrientedCurve2D
point
- a point of the plane
public boolean isInside(Point2D point)
isInside
in interface Boundary2D
isInside
in interface OrientedCurve2D
point
- a point in the plane
public double signedDistance(Point2D point)
signedDistance
in interface OrientedCurve2D
point
- a point of the plane
public double signedDistance(double x, double y)
OrientedCurve2D
signedDistance
in interface OrientedCurve2D
x
- x-coord of a pointy
- y-coord of a point
public Vector2D tangent(double t)
SmoothCurve2D
tangent
in interface SmoothCurve2D
t
- a position on the curve
SmoothCurve2D.normal(double)
public double curvature(double t)
curvature
in interface ContinuousCurve2D
t
- the position on the curve
public boolean isClosed()
isClosed
in interface ContinuousCurve2D
public LinearRing2D asPolyline(int n)
AbstractContinuousCurve2D
asPolyline
in interface ContinuousCurve2D
asPolyline
in class AbstractContinuousCurve2D
n
- the number of line segments
n
line segments.ContinuousCurve2D.asPolyline(int)
public boolean isBounded()
isBounded
in interface Shape2D
public boolean isEmpty()
isEmpty
in interface Shape2D
public double t0()
t0
in interface Curve2D
@Deprecated public double getT0()
getT0
in interface Curve2D
public double t1()
t1
in interface Curve2D
@Deprecated public double getT1()
getT1
in interface Curve2D
public Point2D point(double t)
point
in interface Curve2D
public Point2D firstPoint()
firstPoint
in interface Curve2D
firstPoint
in class AbstractContinuousCurve2D
Curve2D.t0()
,
Curve2D.point(double)
public Point2D lastPoint()
lastPoint
in interface Curve2D
lastPoint
in class AbstractContinuousCurve2D
Curve2D.t1()
,
Curve2D.point(double)
public double position(Point2D point)
Curve2D
point(double)
method.
position
in interface Curve2D
point
- a point belonging to the curve
Curve2D.point(double)
public double project(Point2D point)
project
in interface Curve2D
point
- a point to project
public Ellipse2D reverse()
reverse
in interface Conic2D
reverse
in interface EllipseShape2D
reverse
in interface ContinuousCurve2D
reverse
in interface Curve2D
reverse
in interface SmoothCurve2D
reverse
in interface Boundary2D
reverse
in interface ContinuousOrientedCurve2D
reverse
in interface Contour2D
reverse
in interface OrientedCurve2D
reverse
in interface SmoothContour2D
reverse
in interface SmoothOrientedCurve2D
public java.util.Collection<? extends Ellipse2D> continuousCurves()
Curve2D
continuousCurves
in interface EllipseShape2D
continuousCurves
in interface Curve2D
continuousCurves
in interface Boundary2D
continuousCurves
in class AbstractContinuousCurve2D
public EllipseArc2D subCurve(double t0, double t1)
subCurve
in interface ContinuousCurve2D
subCurve
in interface Curve2D
subCurve
in interface SmoothCurve2D
subCurve
in interface ContinuousOrientedCurve2D
subCurve
in interface SmoothOrientedCurve2D
t0
- 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 Shape2D
public CurveSet2D<? extends SmoothOrientedCurve2D> clip(Box2D box)
clip
in interface Conic2D
clip
in interface ContinuousCurve2D
clip
in interface Curve2D
clip
in interface SmoothCurve2D
clip
in interface ContinuousOrientedCurve2D
clip
in interface OrientedCurve2D
clip
in interface SmoothOrientedCurve2D
clip
in interface Shape2D
box
- the clipping box
public Box2D boundingBox()
boundingBox
in interface Shape2D
public 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 Curve2D
public Ellipse2D transform(AffineTransform2D trans)
transform
in interface Conic2D
transform
in interface EllipseShape2D
transform
in interface ContinuousCurve2D
transform
in interface Curve2D
transform
in interface SmoothCurve2D
transform
in interface Boundary2D
transform
in interface ContinuousOrientedCurve2D
transform
in interface Contour2D
transform
in interface OrientedCurve2D
transform
in interface SmoothContour2D
transform
in interface SmoothOrientedCurve2D
transform
in interface Shape2D
trans
- an affine transform
public boolean contains(Point2D p)
contains
in interface Shape2D
public boolean contains(double x, double y)
contains
in interface Shape2D
public java.awt.geom.GeneralPath getGeneralPath()
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
appendPath
in interface ContinuousCurve2D
path
- the path to be completed
public void draw(java.awt.Graphics2D g2)
Curve2D
draw
in interface Curve2D
draw
in interface Shape2D
draw
in class AbstractContinuousCurve2D
g2
- the graphics to draw the curve inpublic boolean almostEquals(GeometricObject2D obj, double eps)
GeometricObject2D
almostEquals
in interface GeometricObject2D
obj
- 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.Object
public Ellipse2D clone()
Curve2D
clone
in interface Curve2D
clone
in class AbstractSmoothCurve2D
public 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 |