math.geom2d.conic
Class Circle2D
- java.lang.Object
-
- math.geom2d.curve.AbstractContinuousCurve2D
-
- math.geom2d.curve.AbstractSmoothCurve2D
-
- 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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface math.geom2d.conic.Conic2D
Conic2D.Type
-
-
Constructor Summary
Constructors Constructor and Description Circle2D()Empty constructor: center 0,0 and radius 0.Circle2D(double xcenter, double ycenter, double radius)Create a new circle with specified center and radiusCircle2D(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 radiusCircle2D(Point2D center, double radius, boolean direct)Create a new circle with specified center, radius and orientation
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method and Description booleanalmostEquals(GeometricObject2D obj, double eps)Checks if the two objects are similar up to a given threshold value.doubleangle()Returns the angle of the circle main axis with the Ox axis.java.awt.geom.GeneralPathappendPath(java.awt.geom.GeneralPath path)Append the path of the curve to the given path.Ellipse2DasEllipse()Converts this circle to an instance of Ellipse2D.LinearRing2DasPolyline(int n)Converts this continuous curve to an instance of LinearCurve2D with the given number of edges.Box2DboundingBox()Returns bounding box of the circle.CirculinearDomain2Dbuffer(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.Point2Dcenter()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 Point2DcircumCenter(Point2D p1, Point2D p2, Point2D p3)Computes the center of the circumscribed circle of the three input points.static Circle2DcircumCircle(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.Circle2Dclone()Deprecated.use copy constructor instead (0.11.2)double[]conicCoefficients()Returns Cartesian equation of the circle:Conic2D.TypeconicType()booleancontains(double x, double y)Returns true if the point (x, y) lies exactly on the circle.booleancontains(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 Circle2Dcreate(Point2D center, double radius)Deprecated.since 0.11.1static Circle2Dcreate(Point2D center, double radius, boolean direct)Deprecated.since 0.11.1static Circle2Dcreate(Point2D p1, Point2D p2, Point2D p3)Deprecated.replaced by createCircle(Point2D, Point2D, Point2D) (0.11.1)doublecurvature(double t)Returns the inverse of the circle radius.doubledistance(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.doubledistance(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.CirculinearDomain2Ddomain()Returns the domain delimited by this boundary.voiddraw(java.awt.Graphics2D g2)Draws the curve on the given Graphics2D object.doubleeccentricity()Returns 0, which is the eccentricity of a circle by definition.booleanequals(java.lang.Object obj)voidfill(java.awt.Graphics2D g2)Fills the interior of the boundary, using the Graphics current Paint.Point2DfirstPoint()Get the first point of the circle, which is the same as the last point.Point2Dfocus1()Returns the first focus, which for a circle is the same point as the center.Point2Dfocus2()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)doublegetT0()Deprecated.replaced by t0() (since 0.11.1).doublegetT1()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.booleanisBounded()Always returns true.booleanisCircle()Returns true if this ellipse shape is similar to a circle, i.e.booleanisClosed()Returns true, as an ellipse is always closed.booleanisDirect()Returns true if circle has a direct orientation.booleanisEmpty()Always returns false.booleanisInside(Point2D point)Test whether the point is inside the circle.Point2DlastPoint()Get the last point of the circle, which is the same as the first point.doublelength()Returns perimeter of the circle (equal to 2*PI*radius).doublelength(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.Circle2Dparallel(double d)Returns the parallel circle located at a distance d from this circle.Point2Dpoint(double t)Get the position of the curve from internal parametric representation, depending on the parameter t.doubleposition(double length)doubleposition(Point2D point)Computes the position of the point on the curve.doubleproject(Point2D point)Computes the projection position of the point on the circle, by computing angle with horizonrtalstatic StraightLine2DradicalAxis(Circle2D circle1, Circle2D circle2)Computes the radical axis of the two circles.doubleradius()Returns the radius of the circle.Circle2Dreverse()Returns the circle with same center and same radius, but with the opposite orientation.doublesignedDistance(double x, double y)The same as distanceSigned(Point2D), but by passing 2 double as arguments.doublesignedDistance(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.CircleArc2DsubCurve(double t0, double t1)Returns a new CircleArc2D.Circle2DsupportingCircle()Returns the circle itself.doublet0()Returns the parameter of the first point of the ellipse, set to 0.doublet1()Returns the parameter of the last point of the ellipse, set to 2*PI.Vector2Dtangent(double t)Returns the tangent of the curve at the given position.java.lang.StringtoString()EllipseShape2Dtransform(AffineTransform2D trans)Transforms this circle by an affine transform.CircleLine2Dtransform(CircleInversion2D inv)Transforms the shape by a circle inversion.Vector2Dvector1()Returns the first direction vector of the circle, in the direction of the major axis.Vector2Dvector2()Returns the second direction vector of the circle, in the direction of the minor axis.doublewindingAngle(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.1Creates a circle from a center and a radius.
-
create
@Deprecated public static Circle2D create(Point2D center, double radius, boolean direct)
Deprecated. since 0.11.1Creates 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 arccircle2- 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:
supportingCirclein interfaceCircularShape2D
-
isDirect
public boolean isDirect()
Returns true if circle has a direct orientation.- Specified by:
isDirectin interfaceEllipseShape2D
-
center
public Point2D center()
Returns center of the circle.- Specified by:
centerin interfaceEllipseShape2D
-
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:EllipseShape2DReturns true if this ellipse shape is similar to a circle, i.e. has same length for both semi-axes.- Specified by:
isCirclein interfaceEllipseShape2D
-
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()
-
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:
conicCoefficientsin interfaceConic2D
-
eccentricity
public double eccentricity()
Returns 0, which is the eccentricity of a circle by definition.- Specified by:
eccentricityin interfaceConic2D
-
buffer
public CirculinearDomain2D buffer(double dist)
Description copied from interface:CirculinearShape2DComputes 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:
bufferin interfaceCirculinearShape2D- 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:
parallelin interfaceCircleLine2D- Specified by:
parallelin interfaceCirculinearBoundary2D- Specified by:
parallelin interfaceCirculinearContinuousCurve2D- Specified by:
parallelin interfaceCirculinearContour2D- Specified by:
parallelin interfaceCirculinearCurve2D- Specified by:
parallelin interfaceCirculinearElement2D- Specified by:
parallelin interfaceCirculinearRing2D- 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:
lengthin interfaceCirculinearCurve2D- Returns:
- the length of the curve
-
length
public double length(double pos)
Returns the geodesic leangth until the given position.- Specified by:
lengthin interfaceCirculinearCurve2D- 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:
positionin interfaceCirculinearCurve2D- Returns:
- the position located at a given geodesic distance from the origin
-
transform
public CircleLine2D transform(CircleInversion2D inv)
Description copied from interface:CirculinearShape2DTransforms the shape by a circle inversion. The result is still an instance a CirculinearShape2D.- Specified by:
transformin interfaceCircleLine2D- Specified by:
transformin interfaceCirculinearBoundary2D- Specified by:
transformin interfaceCirculinearContinuousCurve2D- Specified by:
transformin interfaceCirculinearContour2D- Specified by:
transformin interfaceCirculinearCurve2D- Specified by:
transformin interfaceCirculinearElement2D- Specified by:
transformin interfaceCirculinearShape2D- Parameters:
inv- the circle inversion- Returns:
- the transformed shape
-
domain
public CirculinearDomain2D domain()
Description copied from interface:Boundary2DReturns the domain delimited by this boundary.- Specified by:
domainin interfaceCirculinearBoundary2D- Specified by:
domainin interfaceCirculinearRing2D- Specified by:
domainin interfaceBoundary2D- Returns:
- the domain delimited by this boundary
-
fill
public void fill(java.awt.Graphics2D g2)
Description copied from interface:Boundary2DFills the interior of the boundary, using the Graphics current Paint.- Specified by:
fillin interfaceBoundary2D- 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:
windingAnglein interfaceOrientedCurve2D- Parameters:
point- a point of the plane- Returns:
- a signed angle
-
tangent
public Vector2D tangent(double t)
Description copied from interface:SmoothCurve2DReturns the tangent of the curve at the given position.- Specified by:
tangentin interfaceSmoothCurve2D- 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:
curvaturein interfaceContinuousCurve2D- 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:
smoothPiecesin interfaceCirculinearContinuousCurve2D- Specified by:
smoothPiecesin interfaceContinuousCurve2D- Overrides:
smoothPiecesin classAbstractSmoothCurve2D
-
isClosed
public boolean isClosed()
Returns true, as an ellipse is always closed.- Specified by:
isClosedin interfaceContinuousCurve2D
-
asPolyline
public LinearRing2D asPolyline(int n)
Description copied from class:AbstractContinuousCurve2DConverts 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:
asPolylinein interfaceContinuousCurve2D- Overrides:
asPolylinein classAbstractContinuousCurve2D- Parameters:
n- the number of line segments- Returns:
- a polyline with
nline 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:
isInsidein interfaceBoundary2D- Specified by:
isInsidein interfaceOrientedCurve2D- 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:OrientedCurve2DReturns 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:
signedDistancein interfaceOrientedCurve2D- 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:OrientedCurve2DThe same as distanceSigned(Point2D), but by passing 2 double as arguments.- Specified by:
signedDistancein interfaceOrientedCurve2D- Parameters:
x- x-coord of a pointy- y-coord of a point- Returns:
- the signed distance of the point (x,y) to the curve
-
isBounded
public boolean isBounded()
Always returns true.
-
isEmpty
public boolean isEmpty()
Always returns false.
-
t0
public double t0()
Returns the parameter of the first point of the ellipse, set to 0.
-
getT0
@Deprecated public double getT0()
Deprecated. replaced by t0() (since 0.11.1).
-
t1
public double t1()
Returns the parameter of the last point of the ellipse, set to 2*PI.
-
getT1
@Deprecated public double getT1()
Deprecated. replaced by t1() (since 0.11.1).
-
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.
-
firstPoint
public Point2D firstPoint()
Get the first point of the circle, which is the same as the last point.- Specified by:
firstPointin interfaceCurve2D- Overrides:
firstPointin classAbstractContinuousCurve2D- 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:
lastPointin interfaceCurve2D- Overrides:
lastPointin classAbstractContinuousCurve2D- Returns:
- the last point of the curve.
- See Also:
Curve2D.t1(),Curve2D.point(double)
-
position
public double position(Point2D point)
Description copied from interface:Curve2DComputes the position of the point on the curve. If the point does not belong to the curve, return Double.NaN. It is complementary to thepoint(double)method.- Specified by:
positionin interfaceCurve2D- 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
-
reverse
public Circle2D reverse()
Returns the circle with same center and same radius, but with the opposite orientation.- Specified by:
reversein interfaceCircleLine2D- Specified by:
reversein interfaceCirculinearBoundary2D- Specified by:
reversein interfaceCirculinearContinuousCurve2D- Specified by:
reversein interfaceCirculinearContour2D- Specified by:
reversein interfaceCirculinearCurve2D- Specified by:
reversein interfaceCirculinearElement2D- Specified by:
reversein interfaceCirculinearRing2D- Specified by:
reversein interfaceCircularShape2D- Specified by:
reversein interfaceConic2D- Specified by:
reversein interfaceEllipseShape2D- Specified by:
reversein interfaceContinuousCurve2D- Specified by:
reversein interfaceCurve2D- Specified by:
reversein interfaceSmoothCurve2D- Specified by:
reversein interfaceBoundary2D- Specified by:
reversein interfaceContinuousOrientedCurve2D- Specified by:
reversein interfaceContour2D- Specified by:
reversein interfaceOrientedCurve2D- Specified by:
reversein interfaceSmoothContour2D- Specified by:
reversein interfaceSmoothOrientedCurve2D
-
subCurve
public CircleArc2D subCurve(double t0, double t1)
Returns a new CircleArc2D. t0 and t1 are position on circle.- Specified by:
subCurvein interfaceCirculinearContinuousCurve2D- Specified by:
subCurvein interfaceCirculinearCurve2D- Specified by:
subCurvein interfaceCirculinearElement2D- Specified by:
subCurvein interfaceCircularShape2D- Specified by:
subCurvein interfaceContinuousCurve2D- Specified by:
subCurvein interfaceCurve2D- Specified by:
subCurvein interfaceSmoothCurve2D- Specified by:
subCurvein interfaceContinuousOrientedCurve2D- Specified by:
subCurvein interfaceSmoothOrientedCurve2D- Parameters:
t0- position of the start of the sub-curvet1- 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:Curve2DReturns the collection of continuous curves which constitute this curve.- Specified by:
continuousCurvesin interfaceCirculinearBoundary2D- Specified by:
continuousCurvesin interfaceCirculinearCurve2D- Specified by:
continuousCurvesin interfaceEllipseShape2D- Specified by:
continuousCurvesin interfaceCurve2D- Specified by:
continuousCurvesin interfaceBoundary2D- Overrides:
continuousCurvesin classAbstractContinuousCurve2D- Returns:
- a collection of continuous curves.
-
distance
public double distance(Point2D point)
Description copied from interface:Shape2DReturns 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.
-
distance
public double distance(double x, double y)Description copied from interface:Shape2DReturns 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.
-
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:
intersectionsin interfaceCurve2D
-
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:
clipin interfaceCirculinearBoundary2D- Specified by:
clipin interfaceCirculinearContinuousCurve2D- Specified by:
clipin interfaceCirculinearCurve2D- Specified by:
clipin interfaceCirculinearElement2D- Specified by:
clipin interfaceCircularShape2D- Specified by:
clipin interfaceConic2D- Specified by:
clipin interfaceContinuousCurve2D- Specified by:
clipin interfaceCurve2D- Specified by:
clipin interfaceSmoothCurve2D- Specified by:
clipin interfaceContinuousOrientedCurve2D- Specified by:
clipin interfaceOrientedCurve2D- Specified by:
clipin interfaceSmoothOrientedCurve2D- Specified by:
clipin interfaceShape2D- 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.
-
contains
public boolean contains(double x, double y)Returns true if the point (x, y) lies exactly on the circle.
-
appendPath
public java.awt.geom.GeneralPath appendPath(java.awt.geom.GeneralPath path)
Description copied from interface:ContinuousCurve2DAppend the path of the curve to the given path.- Specified by:
appendPathin interfaceContinuousCurve2D- Parameters:
path- a path to modify- Returns:
- the modified path
-
draw
public void draw(java.awt.Graphics2D g2)
Description copied from interface:Curve2DDraws the curve on the given Graphics2D object.
-
almostEquals
public boolean almostEquals(GeometricObject2D obj, double eps)
Description copied from interface:GeometricObject2DChecks 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:
almostEqualsin interfaceGeometricObject2D- Parameters:
obj- the object to compareeps- 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:
boundingBoxin interfaceShape2D- 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:
transformin interfaceConic2D- Specified by:
transformin interfaceEllipseShape2D- Specified by:
transformin interfaceContinuousCurve2D- Specified by:
transformin interfaceCurve2D- Specified by:
transformin interfaceSmoothCurve2D- Specified by:
transformin interfaceBoundary2D- Specified by:
transformin interfaceContinuousOrientedCurve2D- Specified by:
transformin interfaceContour2D- Specified by:
transformin interfaceOrientedCurve2D- Specified by:
transformin interfaceSmoothContour2D- Specified by:
transformin interfaceSmoothOrientedCurve2D- Specified by:
transformin interfaceShape2D- Parameters:
trans- an affine transform- Returns:
- the transformed shape
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
clone
@Deprecated public Circle2D clone()
Deprecated. use copy constructor instead (0.11.2)- Specified by:
clonein interfaceCurve2D- Specified by:
clonein classAbstractSmoothCurve2D
-
-
DMelt 3.0 © DataMelt by jWork.ORG