Computes the 3d convex hull of a spatial point set.

Namespace:  ceometric.ComputationalGeometry
Assembly:  ceometric.ComputationalGeometry (in ceometric.ComputationalGeometry.dll) Version: 2.4.0.0 (2.4.0.0)

Syntax

C#
public class ConvexHull3d
Visual Basic (Declaration)
Public Class ConvexHull3d
Visual C++
public ref class ConvexHull3d

Remarks

The convex hull of a set P of n points is a convex polytope whose vertices are points in P. This is, all points of a set of points lie within the convex hull or on its surface. This class computes the 3d convex hull of n points in O(n*log(n)) time using O(n) storage. Exact arithmetic provides ultimate robustness. Coplanar facets are not merged, so the hull always consists of triangles.

Examples

CopyC#
// instantiate a 3d convex hull
ConvexHull3d hull3d = new ConvexHull3d();
// assign the points for which to find the hull
hull3d.InitialPoints = SamplePoints.RandomInCube(10000, 1, 1, 1);
// compute the hull
hull3d.ComputeHull();
// output some interesting properties
Console.WriteLine("Number of faces   : " + hull3d.Triangles.Count);
Console.WriteLine("Number of vertices: " + hull3d.Vertices.Count);
Console.WriteLine("Surface area      : " + hull3d.Area);
Console.WriteLine("Volume            : " + hull3d.Volume);
// visualize the hull:
Scene sc = new Scene();
sc.Add(hull3d.InitialPoints, "Points", 1); // Add the initial points on a red layer "Points"
sc.Add(hull3d.Triangles, "Hull", 2);       // Add the hull faces on a yellow layer "Hull"
sc.WriteDxf(@"c:\hull3d.dxf");

Inheritance Hierarchy

System..::.Object
  ceometric.ComputationalGeometry..::.ConvexHull3d

See Also