math.geom2d.conic
Class Ellipse2D

java.lang.Object
  extended by math.geom2d.curve.AbstractContinuousCurve2D
      extended by math.geom2d.curve.AbstractSmoothCurve2D
          extended by math.geom2d.conic.Ellipse2D
All Implemented Interfaces:
java.lang.Cloneable, Conic2D, EllipseShape2D, ContinuousCurve2D, Curve2D, SmoothCurve2D, Boundary2D, ContinuousOrientedCurve2D, Contour2D, OrientedCurve2D, SmoothContour2D, SmoothOrientedCurve2D, GeometricObject2D, Shape2D

public class Ellipse2D
extends AbstractSmoothCurve2D
implements EllipseShape2D, java.lang.Cloneable

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

Ellipse2D

public Ellipse2D()
Empty constructor, define ellipse centered at origin with both major and minor semi-axis with length equal to 1.


Ellipse2D

public Ellipse2D(Point2D center,
                 double l1,
                 double l2)
Main constructor: define center by a point plus major and minor semi axis


Ellipse2D

public Ellipse2D(double xc,
                 double yc,
                 double l1,
                 double l2)
Define center by coordinate, plus major and minor semi axis


Ellipse2D

public Ellipse2D(Point2D center,
                 double l1,
                 double l2,
                 double theta)
Define center by point, major and minor semi axis lengths, and orientation angle.


Ellipse2D

public 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

public 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

public Ellipse2D(java.awt.geom.Ellipse2D ellipse)
construct an ellipse from the java.awt.geom class for ellipse.

Method Detail

create

public static Ellipse2D create(Point2D focus1,
                               Point2D focus2,
                               double chord)
Create a new Ellipse by specifying the two focii, and the length of the chord. The chord equals the sum of distances between a point of the ellipse and each focus.

Parameters:
focus1 - the first focus
focus2 - the second focus
chord - the sum of distances to focii
Returns:
a new instance of Ellipse2D

create

@Deprecated
public static Ellipse2D create(Point2D center,
                                          double l1,
                                          double l2)
Deprecated. since 0.11.1

Main constructor: define center by a point plus major and minor semi axis


create

@Deprecated
public static Ellipse2D create(Point2D center,
                                          double l1,
                                          double l2,
                                          double theta)
Deprecated. since 0.11.1

Define center by point, major and minor semi axis lengths, and orientation angle.


create

public 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.


create

@Deprecated
public static Ellipse2D create(java.awt.geom.Ellipse2D ellipse)
Deprecated. since 0.11.1

Constructs an ellipse from the java.awt.geom class for ellipse.


reduceCentered

public static Ellipse2D reduceCentered(double[] coefs)
Creates a new Ellipse by reducing the conic coefficients, assuming conic type is ellipse, and ellipse is centered.

Parameters:
coefs - an array of double with at least 3 coefficients containing coefficients for x^2, xy, and y^2 factors.
Returns:
the Ellipse2D corresponding to given coefficients

transformCentered

public static Ellipse2D transformCentered(Ellipse2D ellipse,
                                          AffineTransform2D trans)
Transform an ellipse, by supposing both the ellipse is centered and the transform has no translation part.

Parameters:
ellipse - an ellipse
trans - an affine transform
Returns:
the transformed ellipse, centered around origin

getRho

public double getRho(double angle)
Return the RHO parameter, in a polar representation of the ellipse, centered at the center of ellipse.

Parameters:
angle - : angle from horizontal
Returns:
distance of ellipse from ellipse center in direction theta

projectedPoint

public Point2D projectedPoint(Point2D point)

projectedVector

public Vector2D projectedVector(Point2D point,
                                double eMax)
Compute projection of a point onto an ellipse. Return the polar vector representing the translation from point 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

parallel

public Ellipse2D parallel(double d)
Return the parallel ellipse located at a distance d from this ellipse. For direct ellipse, distance is positive outside of the ellipse, and negative inside


isDirect

public boolean isDirect()
Returns true if ellipse has a direct orientation.

Specified by:
isDirect in interface EllipseShape2D

isCircle

public boolean isCircle()
Returns true if this ellipse is similar to a circle, i.e. has same length for both r1 and r2.

Specified by:
isCircle in interface EllipseShape2D

semiMajorAxisLength

public double semiMajorAxisLength()
Returns the length of the major semi-axis of the ellipse.


semiMinorAxisLength

public double semiMinorAxisLength()
Returns the length of the minor semi-axis of the ellipse.


center

public Point2D center()
Returns center of the ellipse.

Specified by:
center in interface EllipseShape2D

focus1

public Point2D focus1()
Return the first focus. It is defined as the first focus on the Major axis, in the direction given by angle theta.


focus2

public Point2D focus2()
Returns the second focus. It is defined as the second focus on the Major axis, in the direction given by angle theta.


vector1

public Vector2D vector1()
Returns the first direction vector of the ellipse, in the direction of the major axis.


vector2

public Vector2D vector2()
Returns the second direction vector of the ellipse, in the direction of the minor axis.


angle

public double angle()
Returns the angle of the ellipse first axis with the Ox axis.


conicType

public Conic2D.Type conicType()
Specified by:
conicType in interface Conic2D

conicCoefficients

public double[] conicCoefficients()
Returns the conic coefficients of the ellipse. Algorithm taken from http://tog.acm.org/GraphicsGems/gemsv/ch2-6/conmat.c

Specified by:
conicCoefficients in interface Conic2D

eccentricity

public double eccentricity()
Computes eccentricity of ellipse, depending on the lengths of the semi-axes. Eccentricity is 0 for a circle (r1==r2), and tends to 1 when ellipse elongates.

Specified by:
eccentricity in interface Conic2D

domain

public Domain2D domain()
Description copied from interface: Boundary2D
Returns the domain delimited by this boundary.

Specified by:
domain in interface Boundary2D
Returns:
the domain delimited by this boundary

fill

public void fill(java.awt.Graphics2D g2)
Description copied from interface: Boundary2D
Fills the interior of the boundary, using the Graphics current Paint.

Specified by:
fill in interface Boundary2D
Parameters:
g2 - the Graphics to fill on

windingAngle

public 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.

Specified by:
windingAngle in interface OrientedCurve2D
Parameters:
point - a point of the plane
Returns:
a signed angle

isInside

public boolean isInside(Point2D point)
Test whether the point is inside the ellipse. The test is performed by rotating the ellipse and the point to align with axis, rescaling in each direction, then computing distance to origin.

Specified by:
isInside in interface Boundary2D
Specified by:
isInside in interface OrientedCurve2D
Parameters:
point - a point in the plane
Returns:
true if the point is on the left side of the curve.

signedDistance

public double signedDistance(Point2D point)
Returns an approximation of the signed distance to the ellipse. In the current implementation, the ellipse is converted to a polyline.

Specified by:
signedDistance in interface OrientedCurve2D
Parameters:
point - a point of the plane
Returns:
the signed distance to the curve

signedDistance

public double signedDistance(double x,
                             double y)
Description copied from interface: OrientedCurve2D
The same as distanceSigned(Point2D), but by passing 2 double as arguments.

Specified by:
signedDistance in interface OrientedCurve2D
Parameters:
x - x-coord of a point
y - y-coord of a point
Returns:
the signed distance of the point (x,y) to the curve

tangent

public Vector2D tangent(double t)
Description copied from interface: SmoothCurve2D
Returns the tangent of the curve at the given position.

Specified by:
tangent in interface SmoothCurve2D
Parameters:
t - a position on the curve
Returns:
the tangent vector computed for position t
See Also:
SmoothCurve2D.normal(double)

curvature

public double curvature(double t)
Returns the curvature of the ellipse.

Specified by:
curvature in interface ContinuousCurve2D
Parameters:
t - the position on the curve
Returns:
the curvature of the curve for position t

isClosed

public boolean isClosed()
Returns true, as an ellipse is always closed.

Specified by:
isClosed in interface ContinuousCurve2D

asPolyline

public LinearRing2D asPolyline(int n)
Description copied from class: AbstractContinuousCurve2D
Converts this continuous curve to an instance of LinearCurve2D with the given number of edges. Returns either an instance of Polyline2D or LinearRing2D, depending on the curve is closed or not. This method can be overridden to return the correct type.

Specified by:
asPolyline in interface ContinuousCurve2D
Overrides:
asPolyline in class AbstractContinuousCurve2D
Parameters:
n - the number of line segments
Returns:
a polyline with n line segments.
See Also:
ContinuousCurve2D.asPolyline(int)

isBounded

public boolean isBounded()
Always returns true.

Specified by:
isBounded in interface Shape2D

isEmpty

public boolean isEmpty()
Always returns false.

Specified by:
isEmpty in interface Shape2D
Returns:
true if the shape does not contain any point.

t0

public double t0()
Returns the parameter of the first point of the ellipse, set to 0.

Specified by:
t0 in interface Curve2D

getT0

@Deprecated
public double getT0()
Deprecated. replaced by t0() (since 0.11.1).

Specified by:
getT0 in interface Curve2D

t1

public double t1()
Returns the parameter of the last point of the ellipse, set to 2*PI.

Specified by:
t1 in interface Curve2D

getT1

@Deprecated
public double getT1()
Deprecated. replaced by t1() (since 0.11.1).

Specified by:
getT1 in interface Curve2D

point

public Point2D point(double t)
get the position of the curve from internal parametric representation, depending on the parameter t. This parameter is between the two limits 0 and 2*PI.

Specified by:
point in interface Curve2D

firstPoint

public Point2D firstPoint()
Returns the first point of the ellipse, which is the same as the last point.

Specified by:
firstPoint in interface Curve2D
Overrides:
firstPoint in class AbstractContinuousCurve2D
Returns:
the first point of the ellipse
See Also:
Curve2D.t0(), Curve2D.point(double)

lastPoint

public Point2D lastPoint()
Returns the last point of the ellipse, which is the same as the first point.

Specified by:
lastPoint in interface Curve2D
Overrides:
lastPoint in class AbstractContinuousCurve2D
Returns:
the last point of the ellipse.
See Also:
Curve2D.t1(), Curve2D.point(double)

position

public double position(Point2D point)
Description copied from interface: Curve2D
Computes the position of the point on the curve. If the point does not belong to the curve, return Double.NaN. It is complementary to the point(double) method.

Specified by:
position in interface Curve2D
Parameters:
point - a point belonging to the curve
Returns:
the position of the point on the curve
See Also:
Curve2D.point(double)

project

public double project(Point2D point)
Computes the approximate projection position of the point on the ellipse. The ellipse is first converted to a unit circle, then the angular position of the point is computed in the transformed basis.

Specified by:
project in interface Curve2D
Parameters:
point - a point to project
Returns:
the position of the closest orthogonal projection

reverse

public Ellipse2D reverse()
Returns the ellipse with same center and same radius, but with the other orientation.

Specified by:
reverse in interface Conic2D
Specified by:
reverse in interface EllipseShape2D
Specified by:
reverse in interface ContinuousCurve2D
Specified by:
reverse in interface Curve2D
Specified by:
reverse in interface SmoothCurve2D
Specified by:
reverse in interface Boundary2D
Specified by:
reverse in interface ContinuousOrientedCurve2D
Specified by:
reverse in interface Contour2D
Specified by:
reverse in interface OrientedCurve2D
Specified by:
reverse in interface SmoothContour2D
Specified by:
reverse in interface SmoothOrientedCurve2D

continuousCurves

public java.util.Collection<? extends Ellipse2D> continuousCurves()
Description copied from interface: Curve2D
Returns the collection of continuous curves which constitute this curve.

Specified by:
continuousCurves in interface EllipseShape2D
Specified by:
continuousCurves in interface Curve2D
Specified by:
continuousCurves in interface Boundary2D
Overrides:
continuousCurves in class AbstractContinuousCurve2D
Returns:
a collection of continuous curves.

subCurve

public EllipseArc2D subCurve(double t0,
                             double t1)
return a new EllipseArc2D.

Specified by:
subCurve in interface ContinuousCurve2D
Specified by:
subCurve in interface Curve2D
Specified by:
subCurve in interface SmoothCurve2D
Specified by:
subCurve in interface ContinuousOrientedCurve2D
Specified by:
subCurve in interface SmoothOrientedCurve2D
Parameters:
t0 - position of the start of the sub-curve
t1 - position of the end of the sub-curve
Returns:
the portion of original curve comprised between t0 and t1.

distance

public double distance(Point2D point)
Computes distance using a polyline approximation.

Specified by:
distance in interface Shape2D

distance

public double distance(double x,
                       double y)
Description copied from interface: Shape2D
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.

Specified by:
distance in interface Shape2D

clip

public CurveSet2D<? extends SmoothOrientedCurve2D> clip(Box2D box)
Clip the ellipse by a box. The result is an instance of CurveSet2D, which contains only instances of Ellipse2D or EllipseArc2D. If the ellipse is not clipped, the result is an instance of CurveSet2D which contains 0 curves.

Specified by:
clip in interface Conic2D
Specified by:
clip in interface ContinuousCurve2D
Specified by:
clip in interface Curve2D
Specified by:
clip in interface SmoothCurve2D
Specified by:
clip in interface ContinuousOrientedCurve2D
Specified by:
clip in interface OrientedCurve2D
Specified by:
clip in interface SmoothOrientedCurve2D
Specified by:
clip in interface Shape2D
Parameters:
box - the clipping box
Returns:
the clipped shape

boundingBox

public Box2D boundingBox()
Return more precise bounds for the ellipse. Return an instance of Box2D.

Specified by:
boundingBox in interface Shape2D
Returns:
the bounding box of the shape.

intersections

public java.util.Collection<Point2D> intersections(LinearShape2D line)
Compute intersections of the ellipse with a straight object (line, line segment, ray...).

Principle of the algorithm is to transform line and ellipse such that ellipse becomes a circle, then using the intersections computation from circle.

Specified by:
intersections in interface Curve2D

transform

public Ellipse2D transform(AffineTransform2D trans)
Transforms this ellipse by an affine transform. If the transformed shape is a circle (ellipse with equal axis lengths), returns an instance of Circle2D. The resulting ellipse is direct if this ellipse and the transform are either both direct or both indirect.

Specified by:
transform in interface Conic2D
Specified by:
transform in interface EllipseShape2D
Specified by:
transform in interface ContinuousCurve2D
Specified by:
transform in interface Curve2D
Specified by:
transform in interface SmoothCurve2D
Specified by:
transform in interface Boundary2D
Specified by:
transform in interface ContinuousOrientedCurve2D
Specified by:
transform in interface Contour2D
Specified by:
transform in interface OrientedCurve2D
Specified by:
transform in interface SmoothContour2D
Specified by:
transform in interface SmoothOrientedCurve2D
Specified by:
transform in interface Shape2D
Parameters:
trans - an affine transform
Returns:
the transformed shape

contains

public boolean contains(Point2D p)
Returns true if the point p lies on the ellipse, with precision given by Shape2D.ACCURACY.

Specified by:
contains in interface Shape2D

contains

public boolean contains(double x,
                        double y)
Returns true if the point (x, y) lies on the ellipse, with precision given by Shape2D.ACCURACY.

Specified by:
contains in interface Shape2D

getGeneralPath

public java.awt.geom.GeneralPath getGeneralPath()

appendPath

public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
Add the path of the ellipse to the given path.

Specified by:
appendPath in interface ContinuousCurve2D
Parameters:
path - the path to be completed
Returns:
the completed path

draw

public void draw(java.awt.Graphics2D g2)
Description copied from interface: Curve2D
Draws the curve on the given Graphics2D object.

Specified by:
draw in interface Curve2D
Specified by:
draw in interface Shape2D
Overrides:
draw in class AbstractContinuousCurve2D
Parameters:
g2 - the graphics to draw the curve in

almostEquals

public boolean almostEquals(GeometricObject2D obj,
                            double eps)
Description copied from interface: GeometricObject2D
Checks if the two objects are similar up to a given threshold value. This method can be used to compare the results of geometric computations, that introduce errors due to numerical computations.

Specified by:
almostEquals in interface GeometricObject2D
Parameters:
obj - the object to compare
eps - a threshold value, for example the minimal coordinate difference
Returns:
true if both object have the same value up to the threshold

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

clone

public Ellipse2D clone()
Description copied from interface: Curve2D
Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.

Specified by:
clone in interface Curve2D
Specified by:
clone in class AbstractSmoothCurve2D
Returns:
the cloned curve

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object