math.geom2d.conic
Class Circle2D

java.lang.Object
  extended by math.geom2d.curve.AbstractContinuousCurve2D
      extended by math.geom2d.curve.AbstractSmoothCurve2D
          extended by math.geom2d.conic.Circle2D
All Implemented Interfaces:
java.lang.Cloneable, CircleLine2D, CirculinearBoundary2D, CirculinearContinuousCurve2D, CirculinearContour2D, CirculinearCurve2D, CirculinearElement2D, CirculinearRing2D, CirculinearShape2D, CircularShape2D, Conic2D, EllipseShape2D, ContinuousCurve2D, Curve2D, SmoothCurve2D, Boundary2D, ContinuousOrientedCurve2D, Contour2D, OrientedCurve2D, SmoothContour2D, SmoothOrientedCurve2D, GeometricObject2D, Shape2D

public class Circle2D
extends AbstractSmoothCurve2D
implements EllipseShape2D, CircleLine2D, CircularShape2D, CirculinearRing2D, java.lang.Cloneable

A circle in the plane, defined as the set of points located at an equal distance from the circle center. A circle is a particular ellipse, with first and second axis length equal.

Author:
dlegland

Nested Class Summary
 
Nested classes/interfaces inherited from interface math.geom2d.conic.Conic2D
Conic2D.Type
 
Constructor Summary
Circle2D()
          Empty constructor: center 0,0 and radius 0.
Circle2D(double xcenter, double ycenter, double radius)
          Create a new circle with specified center and radius
Circle2D(double xcenter, double ycenter, double radius, boolean direct)
          Create a new circle with specified center, radius and orientation.
Circle2D(Point2D center, double radius)
          Create a new circle with specified point center and radius
Circle2D(Point2D center, double radius, boolean direct)
          Create a new circle with specified center, radius and orientation
 
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 circle main axis with the Ox axis.
 java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
          Append the path of the curve to the given path.
 Ellipse2D asEllipse()
          Converts this circle to an instance of Ellipse2D.
 LinearRing2D asPolyline(int n)
          Converts this continuous curve to an instance of LinearCurve2D with the given number of edges.
 Box2D boundingBox()
          Returns bounding box of the circle.
 CirculinearDomain2D buffer(double dist)
          Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.
 Point2D center()
          Returns center of the circle.
static java.util.Collection<Point2D> circlesIntersections(Circle2D circle1, Circle2D circle2)
          Computes the intersections points between two circles or circular shapes.
static Point2D circumCenter(Point2D p1, Point2D p2, Point2D p3)
          Computes the center of the circumscribed circle of the three input points.
static Circle2D circumCircle(Point2D p1, Point2D p2, Point2D p3)
          Computes the circumscribed circle of the 3 input points.
 CurveSet2D<? extends CircularShape2D> clip(Box2D box)
          Clips the circle by a box.
 Circle2D clone()
          Overrides Object declaration to ensure Curve2D implementation are cloned as Curve2D.
 double[] conicCoefficients()
          Returns Cartesian equation of the circle: (x-xc)^2 + (y-yc)^2 = r^2, giving: x^2 + 0*x*y + y^2 -2*xc*x -2*yc*y + xc*xc+yc*yc-r*r = 0.
 Conic2D.Type conicType()
           
 boolean contains(double x, double y)
          Returns true if the point (x, y) lies exactly on the circle.
 boolean contains(Point2D p)
          Returns true if the point p lies on the ellipse, with precision given by Shape2D.ACCURACY.
 java.util.Collection<? extends Circle2D> continuousCurves()
          Returns the collection of continuous curves which constitute this curve.
static Circle2D create(Point2D center, double radius)
          Deprecated. since 0.11.1
static Circle2D create(Point2D center, double radius, boolean direct)
          Deprecated. since 0.11.1
static Circle2D create(Point2D p1, Point2D p2, Point2D p3)
          Deprecated. replaced by createCircle(Point2D, Point2D, Point2D) (0.11.1)
 double curvature(double t)
          Returns the inverse of the circle radius.
 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)
          Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.
 CirculinearDomain2D domain()
          Returns the domain delimited by this boundary.
 void draw(java.awt.Graphics2D g2)
          Draws the curve on the given Graphics2D object.
 double eccentricity()
          Returns 0, which is the eccentricity of a circle by definition.
 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()
          Get the first point of the circle, which is the same as the last point.
 Point2D focus1()
          Returns the first focus, which for a circle is the same point as the center.
 Point2D focus2()
          Returns the second focus, which for a circle is the same point as the center.
static java.util.Collection<Point2D> getIntersections(Circle2D circle1, Circle2D circle2)
          Deprecated. replaced by circlesIntersections(Circle2D, Circle2D) (0.11.1)
static java.util.Collection<Point2D> getIntersections(CircularShape2D circle, LinearShape2D line)
          Deprecated. replaced by lineCircleIntersections(LinearShape2D, CircularShape2D) (0.11.1)
 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(Circle2D circle)
          Returns the intersection points with another circle.
 java.util.Collection<Point2D> intersections(LinearShape2D line)
          Computes intersections of the circle with a line.
 boolean isBounded()
          Always returns true.
 boolean isCircle()
          Returns true if this ellipse shape is similar to a circle, i.e. has same length for both semi-axes.
 boolean isClosed()
          Returns true, as an ellipse is always closed.
 boolean isDirect()
          Returns true if circle has a direct orientation.
 boolean isEmpty()
          Always returns false.
 boolean isInside(Point2D point)
          Test whether the point is inside the circle.
 Point2D lastPoint()
          Get the last point of the circle, which is the same as the first point.
 double length()
          Returns perimeter of the circle (equal to 2*PI*radius).
 double length(double pos)
          Returns the geodesic leangth until the given position.
static java.util.Collection<Point2D> lineCircleIntersections(LinearShape2D line, CircularShape2D circle)
          Computes intersections of a circle with a line.
 Circle2D parallel(double d)
          Returns the parallel circle located at a distance d from this circle.
 Point2D point(double t)
          Get the position of the curve from internal parametric representation, depending on the parameter t.
 double position(double length)
           
 double position(Point2D point)
          Computes the position of the point on the curve.
 double project(Point2D point)
          Computes the projection position of the point on the circle, by computing angle with horizonrtal
static StraightLine2D radicalAxis(Circle2D circle1, Circle2D circle2)
          Computes the radical axis of the two circles.
 double radius()
          Returns the radius of the circle.
 Circle2D reverse()
          Returns the circle with same center and same radius, but with the opposite orientation.
 double signedDistance(double x, double y)
          The same as distanceSigned(Point2D), but by passing 2 double as arguments.
 double signedDistance(Point2D point)
          Returns the signed distance of the curve to the given point.
 java.util.Collection<? extends Circle2D> smoothPieces()
          Returns a set of smooth curves, which contains only the circle.
 CircleArc2D subCurve(double t0, double t1)
          Returns a new CircleArc2D. t0 and t1 are position on circle.
 Circle2D supportingCircle()
          Returns the circle itself.
 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()
           
 EllipseShape2D transform(AffineTransform2D trans)
          Transforms this circle by an affine transform.
 CircleLine2D transform(CircleInversion2D inv)
          Transforms the shape by a circle inversion.
 Vector2D vector1()
          Returns the first direction vector of the circle, in the direction of the major axis.
 Vector2D vector2()
          Returns the second direction vector of the circle, 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, 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
 

Constructor Detail

Circle2D

public Circle2D()
Empty constructor: center 0,0 and radius 0.


Circle2D

public Circle2D(Point2D center,
                double radius)
Create a new circle with specified point center and radius


Circle2D

public Circle2D(Point2D center,
                double radius,
                boolean direct)
Create a new circle with specified center, radius and orientation


Circle2D

public Circle2D(double xcenter,
                double ycenter,
                double radius)
Create a new circle with specified center and radius


Circle2D

public Circle2D(double xcenter,
                double ycenter,
                double radius,
                boolean direct)
Create a new circle with specified center, radius and orientation.

Method Detail

create

@Deprecated
public static Circle2D create(Point2D center,
                                         double radius)
Deprecated. since 0.11.1

Creates a circle from a center and a radius.


create

@Deprecated
public static Circle2D create(Point2D center,
                                         double radius,
                                         boolean direct)
Deprecated. since 0.11.1

Creates a circle from a center, a radius, and a flag indicating orientation.


create

@Deprecated
public static Circle2D create(Point2D p1,
                                         Point2D p2,
                                         Point2D p3)
Deprecated. replaced by createCircle(Point2D, Point2D, Point2D) (0.11.1)

Creates a circle containing 3 points.


getIntersections

@Deprecated
public static java.util.Collection<Point2D> getIntersections(Circle2D circle1,
                                                                        Circle2D circle2)
Deprecated. replaced by circlesIntersections(Circle2D, Circle2D) (0.11.1)


getIntersections

@Deprecated
public static java.util.Collection<Point2D> getIntersections(CircularShape2D circle,
                                                                        LinearShape2D line)
Deprecated. replaced by lineCircleIntersections(LinearShape2D, CircularShape2D) (0.11.1)

Computes intersections of a circle with a line. Returns an array of Point2D, of size 0, 1 or 2 depending on the distance between circle and line. If there are 2 intersections points, the first one in the array is the first one on the line.


circumCircle

public static Circle2D circumCircle(Point2D p1,
                                    Point2D p2,
                                    Point2D p3)
Computes the circumscribed circle of the 3 input points.

Returns:
the circle that contains the three input points
Throws:
ColinearPoints2DException - if the 3 points are colinear

circumCenter

public static Point2D circumCenter(Point2D p1,
                                   Point2D p2,
                                   Point2D p3)
Computes the center of the circumscribed circle of the three input points.

Throws:
ColinearPoints2DException - if the 3 points are colinear

circlesIntersections

public static java.util.Collection<Point2D> circlesIntersections(Circle2D circle1,
                                                                 Circle2D circle2)
Computes the intersections points between two circles or circular shapes.

Parameters:
circle1 - an instance of circle or circle arc
circle2 - an instance of circle or circle arc
Returns:
a collection of 0, 1 or 2 intersection points

lineCircleIntersections

public static java.util.Collection<Point2D> lineCircleIntersections(LinearShape2D line,
                                                                    CircularShape2D circle)
Computes intersections of a circle with a line. Returns an array of Point2D, of size 0, 1 or 2 depending on the distance between circle and line. If there are 2 intersections points, the first one in the array is the first one on the line.

Returns:
a collection of intersection points
Since:
0.11.1

radicalAxis

public static StraightLine2D radicalAxis(Circle2D circle1,
                                         Circle2D circle2)
Computes the radical axis of the two circles.

Returns:
the radical axis of the two circles.
Throws:
java.lang.IllegalArgumentException - if the two circles have same center
Since:
0.11.1

radius

public double radius()
Returns the radius of the circle.


intersections

public java.util.Collection<Point2D> intersections(Circle2D circle)
Returns the intersection points with another circle. The result is a collection with 0, 1 or 2 points.


supportingCircle

public Circle2D supportingCircle()
Returns the circle itself.

Specified by:
supportingCircle in interface CircularShape2D

isDirect

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

Specified by:
isDirect in interface EllipseShape2D

center

public Point2D center()
Returns center of the circle.

Specified by:
center in interface EllipseShape2D

vector1

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


vector2

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


angle

public double angle()
Returns the angle of the circle main axis with the Ox axis.


focus1

public Point2D focus1()
Returns the first focus, which for a circle is the same point as the center.


focus2

public Point2D focus2()
Returns the second focus, which for a circle is the same point as the center.


isCircle

public boolean isCircle()
Description copied from interface: EllipseShape2D
Returns true if this ellipse shape is similar to a circle, i.e. has same length for both semi-axes.

Specified by:
isCircle in interface EllipseShape2D

asEllipse

public Ellipse2D asEllipse()
Converts this circle to an instance of Ellipse2D.

Returns:
a new instance of Ellipse2D that corresponds to this circle

conicType

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

conicCoefficients

public double[] conicCoefficients()
Returns Cartesian equation of the circle:

(x-xc)^2 + (y-yc)^2 = r^2, giving:

x^2 + 0*x*y + y^2 -2*xc*x -2*yc*y + xc*xc+yc*yc-r*r = 0.

Specified by:
conicCoefficients in interface Conic2D

eccentricity

public double eccentricity()
Returns 0, which is the eccentricity of a circle by definition.

Specified by:
eccentricity in interface Conic2D

buffer

public CirculinearDomain2D buffer(double dist)
Description copied from interface: CirculinearShape2D
Computes the buffer of the shape, formed by the set of points located at a distance from the shape that is lower or equal to d.

Specified by:
buffer in interface CirculinearShape2D
Parameters:
dist - the maximal distance between a point of the buffer and the shape
Returns:
the buffer of the shape

parallel

public Circle2D parallel(double d)
Returns the parallel circle located at a distance d from this circle. For direct circle, distance is positive outside of the circle, and negative inside. This is the contrary for indirect circles.

Specified by:
parallel in interface CircleLine2D
Specified by:
parallel in interface CirculinearBoundary2D
Specified by:
parallel in interface CirculinearContinuousCurve2D
Specified by:
parallel in interface CirculinearContour2D
Specified by:
parallel in interface CirculinearCurve2D
Specified by:
parallel in interface CirculinearElement2D
Specified by:
parallel in interface CirculinearRing2D
Parameters:
d - the distance between the original curve and he parallel curve.
Returns:
the parallel curve

length

public double length()
Returns perimeter of the circle (equal to 2*PI*radius).

Specified by:
length in interface CirculinearCurve2D
Returns:
the length of the curve

length

public double length(double pos)
Returns the geodesic leangth until the given position.

Specified by:
length in interface CirculinearCurve2D
Returns:
the length from the beginning to the position given by pos
See Also:
CirculinearCurve2D.length(double)

position

public double position(double length)
Specified by:
position in interface CirculinearCurve2D
Returns:
the position located at a given geodesic distance from the origin

transform

public CircleLine2D transform(CircleInversion2D inv)
Description copied from interface: CirculinearShape2D
Transforms the shape by a circle inversion. The result is still an instance a CirculinearShape2D.

Specified by:
transform in interface CircleLine2D
Specified by:
transform in interface CirculinearBoundary2D
Specified by:
transform in interface CirculinearContinuousCurve2D
Specified by:
transform in interface CirculinearContour2D
Specified by:
transform in interface CirculinearCurve2D
Specified by:
transform in interface CirculinearElement2D
Specified by:
transform in interface CirculinearShape2D
Parameters:
inv - the circle inversion
Returns:
the transformed shape

domain

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

Specified by:
domain in interface CirculinearBoundary2D
Specified by:
domain in interface CirculinearRing2D
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

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 inverse of the circle radius. If the circle is indirect, the curvature is negative.

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

smoothPieces

public java.util.Collection<? extends Circle2D> smoothPieces()
Returns a set of smooth curves, which contains only the circle.

Specified by:
smoothPieces in interface CirculinearContinuousCurve2D
Specified by:
smoothPieces in interface ContinuousCurve2D
Overrides:
smoothPieces in class AbstractSmoothCurve2D

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)

isInside

public boolean isInside(Point2D point)
Test whether the point is inside the circle. The test is performed by translating the point, and re-scaling it such that its coordinates are expressed in unit circle basis.

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)
Description copied from interface: OrientedCurve2D
Returns the signed distance of the curve to the given point. The distance is positive if the point lies outside the shape, and negative if the point lies inside the shape. In both cases, absolute value of distance is equals to the distance to the border of the shape.

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

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*Math.PI.

Specified by:
point in interface Curve2D

firstPoint

public Point2D firstPoint()
Get the first point of the circle, 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 curve
See Also:
Curve2D.t0(), Curve2D.point(double)

lastPoint

public Point2D lastPoint()
Get the last point of the circle, 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 curve.
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 projection position of the point on the circle, by computing angle with horizonrtal

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

reverse

public Circle2D reverse()
Returns the circle with same center and same radius, but with the opposite orientation.

Specified by:
reverse in interface CircleLine2D
Specified by:
reverse in interface CirculinearBoundary2D
Specified by:
reverse in interface CirculinearContinuousCurve2D
Specified by:
reverse in interface CirculinearContour2D
Specified by:
reverse in interface CirculinearCurve2D
Specified by:
reverse in interface CirculinearElement2D
Specified by:
reverse in interface CirculinearRing2D
Specified by:
reverse in interface CircularShape2D
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

subCurve

public CircleArc2D subCurve(double t0,
                            double t1)
Returns a new CircleArc2D. t0 and t1 are position on circle.

Specified by:
subCurve in interface CirculinearContinuousCurve2D
Specified by:
subCurve in interface CirculinearCurve2D
Specified by:
subCurve in interface CirculinearElement2D
Specified by:
subCurve in interface CircularShape2D
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.

continuousCurves

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

Specified by:
continuousCurves in interface CirculinearBoundary2D
Specified by:
continuousCurves in interface CirculinearCurve2D
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.

distance

public double distance(Point2D point)
Description copied from interface: Shape2D
Returns the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape.

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

intersections

public java.util.Collection<Point2D> intersections(LinearShape2D line)
Computes intersections of the circle with a line. Return an array of Point2D, of size 0, 1 or 2 depending on the distance between circle and line. If there are 2 intersections points, the first one in the array is the first one on the line.

Specified by:
intersections in interface Curve2D

clip

public CurveSet2D<? extends CircularShape2D> clip(Box2D box)
Clips the circle by a box. The result is an instance of CurveSet2D, which contains only instances of CircleArc2D or Circle2D. If the circle is not clipped, the result is an instance of CurveSet2D which contains 0 curves.

Specified by:
clip in interface CirculinearBoundary2D
Specified by:
clip in interface CirculinearContinuousCurve2D
Specified by:
clip in interface CirculinearCurve2D
Specified by:
clip in interface CirculinearElement2D
Specified by:
clip in interface CircularShape2D
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

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 exactly on the circle.

Specified by:
contains in interface Shape2D

appendPath

public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
Description copied from interface: ContinuousCurve2D
Append the path of the curve to the given path.

Specified by:
appendPath in interface ContinuousCurve2D
Parameters:
path - a path to modify
Returns:
the modified 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

boundingBox

public Box2D boundingBox()
Returns bounding box of the circle.

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

transform

public EllipseShape2D transform(AffineTransform2D trans)
Transforms this circle 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

toString

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

equals

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

clone

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