ConvexHull (FPScript)

21.09.2021

Calculates the convex hull of a two-dimensional point set.

Syntax

ConvexHull(Points [ , Algorithm = CONVEXHULL_GRAHAM_SCAN ])
or
ConvexHull(Y, X [ , Algorithm = CONVEXHULL_GRAHAM_SCAN ])

 

The syntax of the ConvexHull function consists of the following parts:

Part

Description

Points

The Y and X points for which the convex hull is to be calculated.

Permitted data structures are signal. All real data types are permitted, except calendar time und time span.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Y

The Y points used to calculate the convex hull. If you specify a signal, then its Y component is used.

Permitted data structures are data series und signal. All real data types are permitted, except calendar time und time span.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

X

The X points used to calculate the convex hull. If you specify a signal, then its Y component is used.

Permitted data structures are data series und signal. All real data types are permitted, except calendar time und time span.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Algorithm

Determines the algorithm for calculating the convex hull.

The argument Algorithm 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 the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value CONVEXHULL_GRAHAM_SCAN.

Remarks

The result always has the data structure signal.

The values are converted to 64-bit floating points before the calculation is made.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Dim y = Noise(1# 100, NOISE_NORMAL, 0)
Dim x = Noise(1# 100, NOISE_NORMAL, 0)
Dim points = Signal(y, x)
List("Points", points, "Convex Hull", ConvexHull(points))

Calculates the convex hull of randomly distributed points in the two-dimensional plane.

See Also

MinimumCircumscribedCircle Function

Share article or send as email:

You might be interested in these articles