java.lang.Object
imagingbook.common.geometry.circle.GeometricCircle
- All Implemented Interfaces:
Primitive2d
,ShapeProducer
Represents a geometric circle with center point (xc, yc) and radius r. Instances are immutable. See Sec. 11.1.1 and Appendix F.2.1 of [1] for details.
[1] W. Burger, M.J. Burge, Digital Image Processing – An Algorithmic Introduction, 3rd ed, Springer (2022).
- Version:
- 2022/11/17
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionGeometricCircle
(double[] p) Constructor.GeometricCircle
(double xc, double yc, double r) Constructor.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this circle.boolean
equals
(GeometricCircle other, double tolerance) boolean
equals
(GeometricCircle other, double tolXc, double tolYc, double tolR) boolean
Returns the center point of this circle.double
getDistance
(Pnt2d p) Returns the (unsigned) distance between the specified point and this circle.double
getMeanSquareError
(Pnt2d[] points) Calculates and returns the mean of the squared distances between this circle and a set of 2D points.double[]
Returns a vector of geometric circle parameters (xc, yc, r).getShape
(double scale) Returns a scaledShape
for this object (default scale is 1).Shape[]
getShapes
(double scale) Returns a fixed sequence ofShape
items for drawing this object, which must contain at least one item.double
Returns the signed distance between the specified point and this circle.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface imagingbook.common.geometry.shape.ShapeProducer
getShape, getShapes
-
Field Details
-
xc
Circle parameter. -
yc
Circle parameter. -
r
Circle parameter.
-
-
Constructor Details
-
GeometricCircle
Constructor.- Parameters:
xc
- center x-coordinateyc
- center y-coordinater
- circle radius
-
GeometricCircle
Constructor. Creates a newGeometricCircle
instance from parameters p = [xc, yc, r].- Parameters:
p
- circle parameters [xc, yc, r]
-
GeometricCircle
Constructor. Creates a newGeometricCircle
from aAlgebraicCircle
instance.- Parameters:
ac
- aAlgebraicCircle
instance
-
-
Method Details
-
getParameters
Returns a vector of geometric circle parameters (xc, yc, r).- Returns:
- geometric circle parameters (xc, yc, r)
-
getCenter
Returns the center point of this circle.- Returns:
- the center point
-
getMeanSquareError
Calculates and returns the mean of the squared distances between this circle and a set of 2D points.- Parameters:
points
- a set of sample points (usually the points used for fitting)- Returns:
- the mean squared error
-
getDistance
Returns the (unsigned) distance between the specified point and this circle. The result is always non-negative.- Specified by:
getDistance
in interfacePrimitive2d
- Parameters:
p
- a 2D point- Returns:
- the point's distance from the circle
-
getSignedDistance
Returns the signed distance between the specified point and this circle. The result is positive for points outside the circle, negative inside.- Parameters:
p
- a 2D point- Returns:
- the point's signed distance from the circle
-
getShape
Description copied from interface:ShapeProducer
Returns a scaledShape
for this object (default scale is 1). Must be defined by implementing classes. The interpretation of the scale factor is left to the implementing class. For example, forPnt2d
it specifies the size of the marker (seePnt2d.getShape(double)
.- Specified by:
getShape
in interfaceShapeProducer
- Parameters:
scale
- the scale of the shape- Returns:
- a
Shape
instance
-
getShapes
Description copied from interface:ShapeProducer
Returns a fixed sequence ofShape
items for drawing this object, which must contain at least one item. This is to produce graphic representations that are too complex for a singleShape
item. The returned shapes may also be displayed with different strokes or colors.By default, this method returns a single item which is the primary shape (obtained by
ShapeProducer.getShape(double)
). Implementing classes should override this method if more than one shape must be returned For example, aGeometricEllipse
returns three shape items: (a) the ellipse curve, (b) the center mark, (c) the major axes (seeGeometricEllipse.getShapes(double)
).- Specified by:
getShapes
in interfaceShapeProducer
- Parameters:
scale
- a scale factor (may be used or ignored)- Returns:
- sequence of
Shape
items
-
equals
-
equals
-
equals
-
duplicate
Returns a copy of this circle.- Returns:
- a copy of this circle
-
toString
-