MinimumCircumscribedCircle (FPScript)
Calculates the minimum circumscribed circle (MCCI) of a two-dimensional point set. Used to determine roundness.
Syntax
MinimumCircumscribedCircle(Points, [ OutputOptions = MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE ], [ CircleSize = 5000 ] [ , ConvexHullAlgorithm = CONVEXHULL_GRAHAM_SCAN ])
or
MinimumCircumscribedCircle(Y, X, [ OutputOptions = MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE ], [ CircleSize = 5000 ] [ , ConvexHullAlgorithm = CONVEXHULL_GRAHAM_SCAN ])
The syntax of the MinimumCircumscribedCircle function consists of the following parts:
Part |
Description |
||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Points |
The Y and X point set for which the minimum circumscribed circle is to be calculated. The same unit must be used for both components of the signal. Permitted data structures are signal. All real data types are permitted, except calendar time und time span. |
||||||||||||||||||||||
Y |
The Y points used to calculate the minimum circumscribed circle. If you specify a signal, its Y component is used. The unit must match the unit of the X argument. Permitted data structures are data series und signal. All real data types are permitted, except calendar time und time span. |
||||||||||||||||||||||
X |
The X points used to calculate the minimum circumscribed circle. If you specify a signal, its Y component is used. The unit must match the unit of the Y argument. Permitted data structures are data series und signal. All real data types are permitted, except calendar time und time span. |
||||||||||||||||||||||
OutputOptions |
Specifies which results are to be returned. Multiple results are output as a list. If, for instance, the radius of the reference circle and the roundness should be output, the argument must contain the value MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE_RADIUS + MCCI_OUTPUT_ROUNDNESS. The argument OutputOptions can have the following values:
If this argument is omitted, it will be set to the default value MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE. |
||||||||||||||||||||||
CircleSize |
Specifies the number of values used to represent the fitted circles. If you enter zero, the original number of values are retained. The argument is considered only if one of the listed circles was selected for OutputOptions. Permitted data structures are scalar value. All integral data types are permitted. The value must be greater or equal to 0. If this argument is omitted, it will be set to the default value 5000. |
||||||||||||||||||||||
ConvexHullAlgorithm |
Determines the algorithm of the convex hull required for calculating the minimum circumscribed circle. The argument ConvexHullAlgorithm can have the following values:
If this argument is omitted, it will be set to the default value CONVEXHULL_GRAHAM_SCAN. |
Remarks
The values are converted to 64-bit floating points before the calculation is made.
In the first step, the convex hull is calculated from the point set (also refer to the ConvexHull function). The minimum circumscribed circle of the convex hull is then calculated with the help of the Skyum algorithm [1]. The run time for this is O(n*log(n)). The circle calculated this way corresponds to the minimum circumscribed circle of the original point set.
The output options of the argument OutputOptions are visualized in the following diagram:
The results can be accessed using the following list element names:
Constant |
Meaning |
---|---|
.["Center_X"] |
X coordinate of the center of the reference circle. |
.["Center_Y"] |
Y coordinate of center the reference circle. |
.["Middle_Circle"] |
Arithmetically determined circle between the reference circle (minimum circumscribed circle) and the inscribed circle. |
.["Middle_Circle_Radius"] |
Radius of the arithmetically averaged circle. |
.["Inscribed_Circle"] |
The maximum inscribed circle related to the reference circle. |
.["Inscribed_Circle_Radius"] |
Radius of the maximum inscribed circle related to the reference circle. |
.["Circumscribed_Circle"] |
Reference circle (minimum circumscribed circle). |
.["Circumscribed_Circle_Radius"] |
Radius of the reference circle. |
.["Roundness"] |
Roundness deviation as the difference between the radii of the circumscribed and inscribed circles. |
You can also always use the Formula.Listelementname syntax.
Note The MCCI roundness calculations are based on the currently valid standard for determining roundness; see [2].
Available in
FlexPro Professional, Developer Suite
Examples
MinimumCircumscribedCircle(y, x)
Calculates the minimum circumscribed circle (MCCI) of a point set.
MinimumCircumscribedCircle(y, x, MCCI_OUTPUT_ROUNDNESS)
Calculates the minimum circumscribed circle (MCCI) of a point set and returns only the roundness.
MinimumCircumscribedCircle(points, MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE_RADIUS + MCCI_OUTPUT_ROUNDNESS)
Calculates the minimum circumscribed circle (MCCI) of a point set. As the result, the radius of the determined circle and the roundness are output as a list.
Dim alpha = Series(0, 2*PI, 0.05)
Dim r = 13.5 + Noise(1 # NumberOfRows(alpha), NOISE_NORMAL)
Dim points = Signal(Noise(1) + r*Sin(alpha), Noise(1) + r*Cos(alpha))
List("Points", points, "Circumscribed Circle", MinimumCircumscribedCircle(points))
Calculates the minimum circumscribed circle (MCCI) of randomly distributed points in the two-dimensional plane.
See Also
MaximumInscribedCircle Function
Circle Approximation - Analysis Object
References
[1] Sven Skyum: A simple algorithm for computing the smallest enclosing circle. In: Information Processing Letters, Vol. 37, Issue 3, Pages 121-125. https://doi.org/10.1016/0020-0190(91)90030-L,1991.
[2] DIN Deutsches Institut für Normung e.V.: Part 1: Vocabulary and parameters of roundness (ISO 12181-1:2011); English translation of DIN EN ISO 12181-1:2011. In: Geometrical product specifications (GPS)- Roundness. 2011.