MinimumCircumscribedCircle (FPScript)

21.09.2021

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:

Constant

Meaning

+ MCCI_OUTPUT_ALL

All available output.

+ MCCI_OUTPUT_CENTER_X

X coordinate of the center of the reference circle. The result is a 64-bit floating point value.

+ MCCI_OUTPUT_CENTER_Y

Y coordinate of center the reference circle. The result is a 64-bit floating point value.

+ MCCI_OUTPUT_MIDDLE_CIRCLE

The arithmetically averaged circle between the minimum circumscribed circle (reference circle) and the largest inscribed circle related to the reference circle. The result is a signal.

+ MCCI_OUTPUT_MIDDLE_CIRCLE_RADIUS

Radius of the arithmetically averaged circle. The result is a 64-bit floating point value.

+ MCCI_OUTPUT_INSCRIBED_CIRCLE

The maximum inscribed circle related to the reference circle. The center of the inscribed circle is equal to the center of the reference circle. The radius of the inscribed circle is the result of the minimum distance of the point set to the center of the circle. The result is a signal.

+ MCCI_OUTPUT_INSCRIBED_CIRCLE_RADIUS

Radius of the inscribed circle related to the reference circle. The result is a 64-bit floating point value.

+ MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE

The calculated reference circle (minimum circumscribed circle) in the two-dimensional plane. The result is a signal.

+ MCCI_OUTPUT_CIRCUMSCRIBED_CIRCLE_RADIUS

Radius of the reference circle. The result is a 64-bit floating point value.

+ MCCI_OUTPUT_ROUNDNESS

The roundness deviation. Is the difference of the radii between the circumscribed and inscribed circles. The result is a 64-bit floating point value.

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:

Constant

Meaning

CONVEXHULL_JARVIS_MARCH

The Jarvis March algorithm (also known as the gift wrapping algorithm) is used to calculate the convex hull. The run time of the algorithm is O(n*h), where h describes the number of points on the convex hull. The algorithm is therefore output-sensitive, meaning that the run time depends on the input data. In the worst case scenario, the algorithm has a quadratic run time. However, in many applications, the number of points on the convex hull is small, so in these cases the algorithm is faster than the Graham-Scan algorithm.

CONVEXHULL_GRAHAM_SCAN

The Graham scan algorithm is used to calculate the convex hull. The algorithm run time is always O(n*log(n)).

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

LeastSquaresCircle Function

MaximumInscribedCircle Function

MinimumZoneCircle Function

ConvexHull Function

GaussianFilter 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.

Share article or send as email:

You might be interested in these articles