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.booleanequals(GeometricCircle other, double tolerance) booleanequals(GeometricCircle other, double tolXc, double tolYc, double tolR) booleanReturns the center point of this circle.doublegetDistance(Pnt2d p) Returns the (unsigned) distance between the specified point and this circle.doublegetMeanSquareError(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 scaledShapefor this object (default scale is 1).Shape[]getShapes(double scale) Returns a fixed sequence ofShapeitems for drawing this object, which must contain at least one item.doubleReturns 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, waitMethods 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 newGeometricCircleinstance from parameters p = [xc, yc, r].- Parameters:
p- circle parameters [xc, yc, r]
-
GeometricCircle
Constructor. Creates a newGeometricCirclefrom aAlgebraicCircleinstance.- Parameters:
ac- aAlgebraicCircleinstance
-
-
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:
getDistancein 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:ShapeProducerReturns a scaledShapefor 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, forPnt2dit specifies the size of the marker (seePnt2d.getShape(double).- Specified by:
getShapein interfaceShapeProducer- Parameters:
scale- the scale of the shape- Returns:
- a
Shapeinstance
-
getShapes
Description copied from interface:ShapeProducerReturns a fixed sequence ofShapeitems for drawing this object, which must contain at least one item. This is to produce graphic representations that are too complex for a singleShapeitem. 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, aGeometricEllipsereturns three shape items: (a) the ellipse curve, (b) the center mark, (c) the major axes (seeGeometricEllipse.getShapes(double)).- Specified by:
getShapesin interfaceShapeProducer- Parameters:
scale- a scale factor (may be used or ignored)- Returns:
- sequence of
Shapeitems
-
equals
-
equals
-
equals
-
duplicate
Returns a copy of this circle.- Returns:
- a copy of this circle
-
toString
-