Method ConvexHull
ConvexHull(Geometry)
Calculates the minimum bounding geometry (convex hull) that completely encloses the given geometry.
Declaration
public static Geometry ConvexHull(this Geometry geometry)
Parameters
| Type | Name | Description |
|---|---|---|
| Geometry | geometry | The input geometry. |
Returns
| Type | Description |
|---|---|
| Geometry | The minimum bounding geometry that completely encloses the given geometry. |
Remarks
The convex hull is the minimal bounding geometry, consisting of straight segments, that encloses the input geometry, such that all outer angles are convex. If you imagine a rubber band stretched around the input geometry, the rubber band takes the shape of the convex hull.
When a geometry contains curves, the computed convex hull will still consist of straight segments, not curves, so may not fit tightly to the geometry.
Exceptions
| Type | Condition |
|---|---|
| NotImplementedException | A true curve geometry was used as input when it is not supported by this operation. |
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET Standard 2.0 | 100.3 - 200.8 |
| .NET | 100.13 - 300.0 |
| .NET Windows | 100.13 - 300.0 |
| .NET Android | 200.0 - 300.0 |
| .NET iOS | 200.0 - 300.0 |
| .NET Framework | 100.0 - 200.8 |
| Xamarin.Android | 100.0 - 100.15 |
| Xamarin.iOS | 100.0 - 100.15 |
| UWP | 100.0 - 200.8 |
Relevant samples
ConvexHull(IEnumerable<Geometry>, bool)
Calculates the minimum bounding straight-edged geometry (convex hull) for the geometries in the given collection.
Declaration
public static IEnumerable<Geometry> ConvexHull(this IEnumerable<Geometry> geometries, bool merge)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Geometry> | geometries | A collection of geometries. |
| bool | merge |
|
Returns
| Type | Description |
|---|---|
| IEnumerable<Geometry> | The minimum bounding straight-edged geometry that completely encloses the geometries in the given
collection.
If |
Remarks
When input geometries contain curves, the computed convex hull will still consist of straight segments, not curves, so may not fit tightly to the geometry.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Indicates that the geometries do not have equivalent spatial references. |
Applies to
Platforms and versions
| Target | Versions |
|---|---|
| .NET Standard 2.0 | 100.3 - 200.8 |
| .NET | 100.13 - 300.0 |
| .NET Windows | 100.13 - 300.0 |
| .NET Android | 200.2 - 300.0 |
| .NET iOS | 200.0 - 300.0 |
| .NET Framework | 100.1 - 200.8 |
| Xamarin.Android | 100.1 - 100.14 |
| Xamarin.iOS | 100.1 - 100.15 |
| UWP | 100.1 - 200.8 |