QuickHullSharp 0.1.0

dotnet add package QuickHullSharp --version 0.1.0
                    
NuGet\Install-Package QuickHullSharp -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="QuickHullSharp" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="QuickHullSharp" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="QuickHullSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add QuickHullSharp --version 0.1.0
                    
#r "nuget: QuickHullSharp, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package QuickHullSharp@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=QuickHullSharp&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=QuickHullSharp&version=0.1.0
                    
Install as a Cake Tool

QuickHullSharp

Build License: MIT

QuickHullSharp computes the 3D convex hull of a point cloud with the QuickHull algorithm. It is a pure C# port of akuukka/quickhull by Antti Kuukka, which is public domain. The port is released under the MIT license.

Targets netstandard2.0, netstandard2.1, net8.0, and net10.0, so it can be used from .NET Framework 4.6.2+, .NET Core 2.0+, .NET 5+, Unity 2021.2+, and Mono.

Installation

dotnet add package QuickHullSharp

Usage

using System.Numerics;
using QuickHullSharp;

Vector3[] points = /* your point cloud */;

ConvexHull<Vector3> hull = QuickHull.ComputeHull(points);
IReadOnlyList<Vector3> vertices = hull.Vertices; // only the hull vertices
IReadOnlyList<int> indices = hull.Indices;       // three indices per triangle
  • ccw (default true): whether the triangles are counter-clockwise seen from outside the hull in a left-handed coordinate system, as upstream defines it. Pass false to get triangles whose right-hand-rule normal (b - a) x (c - a) points out of the hull.
  • useOriginalIndices (default false): when true, the indices refer to the input points and Vertices is a copy of them; otherwise Vertices holds only the points on the hull.
  • epsilon: minimum distance to a face plane for a point to count as outside it, relative to the scale of the point cloud (default 1e-4 for Vector3 input, 1e-7 for double input). The scale is the largest absolute coordinate, so a point cloud far from the origin keeps less detail: translate it near the origin first. A negative or non-finite value throws ArgumentOutOfRangeException.

Degenerate input (fewer than four points, or coincident, collinear or coplanar points) still yields a closed triangle mesh, which is then flat and can contain zero-area triangles that repeat a vertex index.

Double-precision input

Coordinates can also be given as consecutive (x, y, z) triples of double. The vertices are then returned as Vector3D. The hull is always computed in double precision.

double[] coordinates = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1];
ConvexHull<Vector3D> hull = QuickHull.ComputeHullFromCoordinates(coordinates);

ComputeHullAsMeshFromCoordinates is the half edge mesh counterpart. The default epsilon of the double path (1e-7) is 1000x tighter than the Vector3 default (1e-4), so switching paths changes the hull size and speed on dense point clouds: pass the same epsilon to both to get comparable results.

Half edge mesh

ComputeHullAsMesh returns the hull as a half edge mesh, which gives quick access to adjacent faces:

HalfEdgeMesh<Vector3> mesh = QuickHull.ComputeHullAsMesh(points);
foreach (Face face in mesh.Faces)
{
    HalfEdge edge = mesh.HalfEdges[face.HalfEdgeIndex];
    int neighborFace = mesh.HalfEdges[edge.Opp].Face;
}

Credits

Algorithm and original implementation: akuukka/quickhull (public domain).

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 112 11/1/2026