QuickHull

General information about the Quickhull algorithm: Dirk Gregorius. March 2014, Game Developers Conference: Implementing QuickHull.

Constructor

QuickHull()

Properties

.tolerance : Float

The epsilon value that is used for internal comparative operations. The calculation of this value depends on the size of the geometry. Default is -1.

.faces : Array

The generated faces of the convex hull. Default is an empty array.

.newFaces : Array

This array holds the faces that are generated within a single iteration. Default is an empty array.

.assigned : VertexList

This vertex list holds all vertices that are assigned to a face. Default is an empty vertex list.

.unassigned : VertexList

This vertex list holds all vertices that are not assigned to a face. Default is an empty vertex list.

.vertices : Array

The internal representation of the given geometry data (an array of vertices).

Methods

.setFromPoints (points : Array) : QuickHull

points - Array of Vector3s that the resulting convex hull will contain.

Computes to convex hull for the given array of points.

.setFromObject (object : Object3D) : QuickHull

object - Object3D to compute the convex hull of.

Computes the convex hull of an Object3D (including its children), accounting for the world transforms of both the object and its childrens.

.makeEmpty () : QuickHull

Makes this convex hull empty.

.addVertexToFace (vertex : VertexNode, face : Face ) : QuickHull

vertex - The vertex to add.

face - The target face.

Adds a vertex to the 'assigned' list of vertices and assigns it to the given face.

.removeVertexFromFace (vertex : VertexNode, face : Face ) : QuickHull

vertex - The vertex to remove.

face - The target face.

Removes a vertex from the 'assigned' list of vertices and from the given face. It also makes sure that the link from 'face' to the first vertex it sees in 'assigned' is linked correctly after the removal.

.removeAllVerticesFromFace (face : Face ) : VertexNode

face - The given face.

Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertext list.

.deleteFaceVertices (face : Face, absorbingFace : Face ) : QuickHull

face - The given face.

absorbingFace - An optional face that tries to absorb the vertices of the first face.

Removes all the visible vertices that 'face' is able to see.

.resolveUnassignedPoints (newFaces : Array ) : QuickHull

newFaces - An array of new faces.

Reassigns as many vertices as possible from the unassigned list to the new faces.

.computeExtremes () : Object

Computes the extremes values (min/max vectors) which will be used to compute the inital hull.

.computeInitialHull () : QuickHull

Computes the initial simplex assigning to its faces all the points that are candidates to form part of the hull.

.reindexFaces () : QuickHull

Removes inactive (e.g. deleted) faces from the internal face list.

.nextVertexToAdd () : VertexNode

Finds the next vertex to create faces with the current hull.

.computeHorizon (eyePoint : Vector3, crossEdge : HalfEdge, face : Face, horizon : Array ) : QuickHull

eyePoint - The 3D-coordinates of a point.

crossEdge - The edge used to jump to the current face.

face - The current face being tested.

horizon - The edges that form part of the horizon in CCW order.

Computes a chain of half edges in CCW order called the 'horizon'. For an edge to be part of the horizon it must join a face that can see 'eyePoint' and a face that cannot see 'eyePoint'.

.addAdjoiningFace (eyeVertex : VertexNode, horizonEdge : HalfEdge) : HalfEdge

eyeVertex - The vertex that is added to the hull.

horizonEdge - A single edge of the horizon.

Creates a face with the vertices 'eyeVertex.point', 'horizonEdge.tail' and 'horizonEdge.head' in CCW order. All the half edges are created in CCW order thus the face is always pointing outside the hull

.addNewFaces (eyeVertex : VertexNode, horizonEdge : HalfEdge) : QuickHull

eyeVertex - The vertex that is added to the hull.

horizon - An array of half-edges that form the horizon.

Adds 'horizon.length' faces to the hull, each face will be linked with the horizon opposite face and the face on the left/right.

.addVertexToHull (eyeVertex : VertexNode) : QuickHull

eyeVertex - The vertex that is added to the hull.

Adds a vertex to the hull with the following algorithm

.cleanup () : QuickHull

Cleans up internal properties after computing the convex hull.

.compute () : QuickHull

Starts the execution of the quick hull algorithm.

Source

For more info on how to obtain the source code of this module see this page.