RhinoCommon ConvexHull -?

I know this has been asked in the past and it appears that currently there is still no native RhinoCommon method for this. So I guess the only possibility is importing the GH node?

Are there any plans to port that or QuickHull to RhinoCommon soon?

1 Like

Hi @Helvetosaur,

An option might be to use RhinoPolyhedra, which exposes a QuickHull solver.

import clr
import sys
import Rhino
import scriptcontext as sc
import rhinoscriptsyntax as rs
from System import Array

# Note, this path may vary
sys.path.append('%APPDATA%/McNeel/Rhinoceros?6.0?Plug-ins/Rhino Polyhedra (666ae572-a6c5-44b5-b668-6b503d56c199)/6.0.6844.19198')
clr.AddReference('PolyhedraCommon.dll')
import PolyhedraCommon

points = rs.GetPointCoordinates("Select points")

arr = Array[Rhino.Geometry.Point3d](points)
polylines = PolyhedraCommon.Geometry.WatermanPolyhedron.CalculateConvexHull(arr)
mesh = PolyhedraCommon.PolyhedraUtils.MeshFromClosedPolylines(polylines, sc.doc.ModelAbsoluteTolerance)
sc.doc.Objects.AddMesh(mesh)
sc.doc.Views.Redraw()

– Dale

3 Likes

Anything happening on this or is it still necessary to get this function via GH or RhinoPolyhedra?

1 Like

Hi @Helvetosaur,

RhinoCommon doesn’t have a convex hull calculation method, nor does the Rhino SDK.

– Dale

Hi @dale,

Quite old topic, but why not include the QuickHull calculation inside RhinoCommon? This is quite an handy feature :slight_smile:

1 Like

Hi @jeffoulet,

I believe something is in the works already.

https://mcneel.myjetbrains.com/youtrack/issue/RH-68446

RhinoPolyhedra uses a three dimensional implementation of Quickhull, as described in Barber, Dobkin, and Huhdanpaa, The Quickhull Algorithm for Convex Hulls (ACM Transactions on Mathematical Software, Vol. 22, No. 4, December 1996). I don’t know what algorithm GH2 has implemented.

– Dale

2 Likes

Hi @dale,

Thanks for your feedback, this is a great news! :slight_smile:

It’s probably worth mentioning MIConvexHull here as well, which is C# and open source:

1 Like

Thanks! Didn’t know this project.

MIConvexHull is also available as a NuGet package.

– Dale

1 Like