ArcGIS Pro 2.7 API Reference Guide
ConvexHull Method (IGeometryEngine)
Example 

ArcGIS.Core.Geometry Namespace > IGeometryEngine Interface : ConvexHull Method
The geometry to create a convex hull of.
Constructs the convex hull of the geometry.
Syntax
Geometry ConvexHull( 
   Geometry geometry
)
Function ConvexHull( _
   ByVal geometry As Geometry _
) As Geometry

Parameters

geometry
The geometry to create a convex hull of.

Return Value

A geometry that represents the convex hull of the input geometry.
Exceptions
ExceptionDescription
Geometry is null or empty.
The method is not implemented for GeometryBag.
Remarks
The convex hull of a geometry is the minimal bounding polygon such that all outer angles are convex. The ConvexHull of a point is the point itself.

GeometryEngine ConvexHull

Example
//
// convex hull around a point - returns a point
//

MapPoint pt = MapPointBuilder.CreateMapPoint(2.0, 2.0);
Geometry hull = GeometryEngine.Instance.ConvexHull(pt);
MapPoint hullPt = hull as MapPoint;
// nullPt.X = 2
// hullPt.Y = 2


List<MapPoint> list = new List<MapPoint>();
list.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));
list.Add(MapPointBuilder.CreateMapPoint(1.0, 2.0));
list.Add(MapPointBuilder.CreateMapPoint(2.0, 2.0));
list.Add(MapPointBuilder.CreateMapPoint(2.0, 1.0));

//
// convex hull around a multipoint - returns a polygon
//

// build a multiPoint
Multipoint multiPoint = MultipointBuilder.CreateMultipoint(list);

hull = GeometryEngine.Instance.ConvexHull(multiPoint);
Polygon hullPoly = hull as Polygon;
// hullPoly.Area = 1
// hullPoly.PointCount = 5

// 
// convex hull around a line - returns a polyline or polygon
// 

List<MapPoint> polylineList = new List<MapPoint>();
polylineList.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));
polylineList.Add(MapPointBuilder.CreateMapPoint(2.0, 2.0));

// 2 point straight line
Polyline polyline = PolylineBuilder.CreatePolyline(polylineList);
hull = GeometryEngine.Instance.ConvexHull(polyline);
Polyline hullPolyline = hull as Polyline;
// hullPolyline.Length = Math.Sqrt(2)
// hullPolyline.PointCount = 2

// 3 point angular line
polylineList.Add(MapPointBuilder.CreateMapPoint(2.0, 1.0));
polyline = PolylineBuilder.CreatePolyline(polylineList);
hull = GeometryEngine.Instance.ConvexHull(polyline);
hullPoly = hull as Polygon;
// hullPoly.Length = 2 + Math.Sqrt(2)
// hullPoly.Area = 0.5
// hullPoly.PointCount = 4

//
// convex hull around a polygon - returns a polygon
//

// simple polygon
Polygon poly = PolygonBuilder.CreatePolygon(list);
hull = GeometryEngine.Instance.ConvexHull(poly);
hullPoly = hull as Polygon;

// hullPoly.Length = 4.0
// hullPoly.Area = 1.0
// hullPoly.PointCount = 5

// polygon with concave angles
List<MapPoint> funkyList = new List<MapPoint>();
funkyList.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));
funkyList.Add(MapPointBuilder.CreateMapPoint(1.5, 1.5));
funkyList.Add(MapPointBuilder.CreateMapPoint(1.0, 2.0));
funkyList.Add(MapPointBuilder.CreateMapPoint(2.0, 2.0));
funkyList.Add(MapPointBuilder.CreateMapPoint(1.5, 1.5));
funkyList.Add(MapPointBuilder.CreateMapPoint(2.0, 1.0));
funkyList.Add(MapPointBuilder.CreateMapPoint(1.0, 1.0));

Polygon funkyPoly = PolygonBuilder.CreatePolygon(funkyList);
hull = GeometryEngine.Instance.ConvexHull(funkyPoly);
hullPoly = hull as Polygon;
// hullPoly.Length = 4.0
// hullPoly.Area = 1.0
// hullPoly.PointCount = 5
// hullPoly.Points[0] = 1.0, 1.0
// hullPoly.Points[1] = 1.0, 2.0
// hullPoly.Points[2] = 2.0, 2.0
// hullPoly.Points[3] = 2.0, 1.0
// hullPoly.Points[4] = 1.0, 1.0
Requirements

Target Platforms: Windows 10, Windows 8.1

See Also

Reference

IGeometryEngine Interface
IGeometryEngine Members