|
@@ -2,7 +2,7 @@
|
|
<html lang="en">
|
|
<html lang="en">
|
|
<head>
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta charset="utf-8" />
|
|
- <base href="../../" />
|
|
|
|
|
|
+ <base href="../../../../" />
|
|
<script src="list.js"></script>
|
|
<script src="list.js"></script>
|
|
<script src="page.js"></script>
|
|
<script src="page.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
@@ -11,7 +11,7 @@
|
|
<h1>[name]</h1>
|
|
<h1>[name]</h1>
|
|
|
|
|
|
<p class="desc">
|
|
<p class="desc">
|
|
- General information about the Quickhull algorithm: Dirk Gregorius. March 2014, Game Developers Conference: [link:http://media.steampowered.com/apps/valve/2014/DirkGregorius_ImplementingQuickHull.pdf Implementing QuickHull].
|
|
|
|
|
|
+ A convex hull class. Implements the Quickhull algorithm by: Dirk Gregorius. March 2014, Game Developers Conference: [link:http://media.steampowered.com/apps/valve/2014/DirkGregorius_ImplementingQuickHull.pdf Implementing QuickHull].
|
|
</p>
|
|
</p>
|
|
|
|
|
|
|
|
|
|
@@ -24,9 +24,9 @@
|
|
|
|
|
|
<h2>Properties</h2>
|
|
<h2>Properties</h2>
|
|
|
|
|
|
- <h3>[property:Float tolerance]</h3>
|
|
|
|
|
|
+ <h3>[property:VertexList assigned]</h3>
|
|
<p>
|
|
<p>
|
|
- 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.
|
|
|
|
|
|
+ This [page:VertexList vertex list] holds all vertices that are assigned to a face. Default is an empty vertex list.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:Array faces]</h3>
|
|
<h3>[property:Array faces]</h3>
|
|
@@ -39,9 +39,9 @@
|
|
This array holds the faces that are generated within a single iteration. Default is an empty array.
|
|
This array holds the faces that are generated within a single iteration. Default is an empty array.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h3>[property:VertexList assigned]</h3>
|
|
|
|
|
|
+ <h3>[property:Float tolerance]</h3>
|
|
<p>
|
|
<p>
|
|
- This [page:VertexList vertex list] holds all vertices that are assigned to a face. Default is an empty vertex list.
|
|
|
|
|
|
+ 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.
|
|
</p>
|
|
</p>
|
|
|
|
|
|
<h3>[property:VertexList unassigned]</h3>
|
|
<h3>[property:VertexList unassigned]</h3>
|
|
@@ -56,39 +56,67 @@
|
|
|
|
|
|
<h2>Methods</h2>
|
|
<h2>Methods</h2>
|
|
|
|
|
|
- <h3>[method:QuickHull setFromPoints]( [param:Array points] )</h3>
|
|
|
|
- [page:Array points] - Array of [page:Vector3 Vector3s] that the resulting convex hull will contain.<br /><br />
|
|
|
|
-
|
|
|
|
- <p>Computes to convex hull for the given array of points.</p>
|
|
|
|
-
|
|
|
|
- <h3>[method:QuickHull setFromObject]( [param:Object3D object] )</h3>
|
|
|
|
- [page:Object3D object] - [page:Object3D] to compute the convex hull of.<br /><br />
|
|
|
|
|
|
+ <h3>[method:HalfEdge addAdjoiningFace]( [param:VertexNode eyeVertex], [param:HalfEdge horizonEdge] )</h3>
|
|
|
|
+ [page:VertexNode eyeVertex] - The vertex that is added to the hull.<br /><br />
|
|
|
|
+ [page:HalfEdge horizonEdge] - A single edge of the horizon.<br /><br />
|
|
|
|
|
|
- <p>Computes the convex hull of an [page:Object3D] (including its children),
|
|
|
|
- accounting for the world transforms of both the object and its childrens.</p>
|
|
|
|
|
|
+ <p>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</p>
|
|
|
|
|
|
- <h3>[method:QuickHull makeEmpty]()</h3>
|
|
|
|
|
|
+ <h3>[method:ConvexHull addNewFaces]( [param:VertexNode eyeVertex], [param:HalfEdge horizonEdge] )</h3>
|
|
|
|
+ [page:VertexNode eyeVertex] - The vertex that is added to the hull.<br /><br />
|
|
|
|
+ [page:HalfEdge horizon] - An array of half-edges that form the horizon.<br /><br />
|
|
|
|
|
|
- <p>Makes this convex hull empty.</p>
|
|
|
|
|
|
+ <p>Adds 'horizon.length' faces to the hull, each face will be linked with the horizon opposite face and the face on the left/right.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull addVertexToFace]( [param:VertexNode vertex], [param:Face face] )</h3>
|
|
|
|
|
|
+ <h3>[method:ConvexHull addVertexToFace]( [param:VertexNode vertex], [param:Face face] )</h3>
|
|
[page:VertexNodeNode vertex] - The vertex to add.<br /><br />
|
|
[page:VertexNodeNode vertex] - The vertex to add.<br /><br />
|
|
[page:Face face] - The target face.<br /><br />
|
|
[page:Face face] - The target face.<br /><br />
|
|
|
|
|
|
<p>Adds a vertex to the 'assigned' list of vertices and assigns it to the given face.</p>
|
|
<p>Adds a vertex to the 'assigned' list of vertices and assigns it to the given face.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull removeVertexFromFace]( [param:VertexNode vertex], [param:Face face] )</h3>
|
|
|
|
- [page:VertexNode vertex] - The vertex to remove.<br /><br />
|
|
|
|
- [page:Face face] - The target face.<br /><br />
|
|
|
|
|
|
+ <h3>[method:ConvexHull addVertexToHull]( [param:VertexNode eyeVertex] )</h3>
|
|
|
|
+ [page:VertexNode eyeVertex] - The vertex that is added to the hull.<br /><br />
|
|
|
|
|
|
- <p>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.</p>
|
|
|
|
|
|
+ <p>Adds a vertex to the hull with the following algorithm
|
|
|
|
+ <ul>
|
|
|
|
+ <li>Compute the 'horizon' which is a chain of half edges. For an edge to belong to this group it must be the edge connecting a face that can see 'eyeVertex' and a face which cannot see 'eyeVertex'.</li>
|
|
|
|
+ <li>All the faces that can see 'eyeVertex' have its visible vertices removed from the assigned vertex list.</li>
|
|
|
|
+ <li>A new set of faces is created with each edge of the 'horizon' and 'eyeVertex'. Each face is connected with the opposite horizon face and the face on the left/right.</li>
|
|
|
|
+ <li>The vertices removed from all the visible faces are assigned to the new faces if possible.</li>
|
|
|
|
+ </ul>
|
|
|
|
+ </p>
|
|
|
|
|
|
- <h3>[method:VertexNode removeAllVerticesFromFace]( [param:Face face] )</h3>
|
|
|
|
- [page:Face face] - The given face.<br /><br />
|
|
|
|
|
|
+ <h3>[method:ConvexHull cleanup]()</h3>
|
|
|
|
|
|
- <p>Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertext list.</p>
|
|
|
|
|
|
+ <p>Cleans up internal properties after computing the convex hull.</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:ConvexHull compute]()</h3>
|
|
|
|
+
|
|
|
|
+ <p>Starts the execution of the quick hull algorithm.</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:Object computeExtremes]()</h3>
|
|
|
|
+
|
|
|
|
+ <p>Computes the extremes values (min/max vectors) which will be used to compute the inital hull.</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:ConvexHull computeHorizon]( [param:Vector3 eyePoint], [param:HalfEdge crossEdge], [param:Face face], [param:Array horizon] )</h3>
|
|
|
|
+ [page:Vector3 eyePoint] - The 3D-coordinates of a point.<br /><br />
|
|
|
|
+ [page:HalfEdge crossEdge] - The edge used to jump to the current face.<br /><br />
|
|
|
|
+ [page:Face face] - The current face being tested.<br /><br />
|
|
|
|
+ [page:Array horizon] - The edges that form part of the horizon in CCW order.<br /><br />
|
|
|
|
+
|
|
|
|
+ <p>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'.</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:ConvexHull computeInitialHull]()</h3>
|
|
|
|
+
|
|
|
|
+ <p>Computes the initial simplex assigning to its faces all the points that are candidates to form part of the hull.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull deleteFaceVertices]( [param:Face face], [param:Face absorbingFace] )</h3>
|
|
|
|
|
|
+ <h3>[method:ConvexHull containsPoint]( [param:Vector3 point] )</h3>
|
|
|
|
+ [page:Vector3 point] - A point in 3D space.<br /><br />
|
|
|
|
+
|
|
|
|
+ <p>Returns *true* if the given point is inside this convex hull.</p>
|
|
|
|
+
|
|
|
|
+ <h3>[method:ConvexHull deleteFaceVertices]( [param:Face face], [param:Face absorbingFace] )</h3>
|
|
[page:Face face] - The given face.<br /><br />
|
|
[page:Face face] - The given face.<br /><br />
|
|
[page:Face absorbingFace] - An optional face that tries to absorb the vertices of the first face.<br /><br />
|
|
[page:Face absorbingFace] - An optional face that tries to absorb the vertices of the first face.<br /><br />
|
|
|
|
|
|
@@ -100,22 +128,20 @@
|
|
</ul>
|
|
</ul>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h3>[method:QuickHull resolveUnassignedPoints]( [param:Array newFaces] )</h3>
|
|
|
|
- [page:Face newFaces] - An array of new faces.<br /><br />
|
|
|
|
-
|
|
|
|
- <p>Reassigns as many vertices as possible from the unassigned list to the new faces.</p>
|
|
|
|
|
|
+ <h3>[method:Vector3 intersectRay]( [param:Ray ray], [param:Vector3 target] )</h3>
|
|
|
|
+ [page:Ray ray] - The given ray.<br /><br />
|
|
|
|
+ [page:Vector3 target] - The target vector representing the intersection point.<br /><br />
|
|
|
|
|
|
- <h3>[method:Object computeExtremes]()</h3>
|
|
|
|
|
|
+ <p>Performs a ray intersection test with this convext hull. If no intersection is found, *null* is returned.</p>
|
|
|
|
|
|
- <p>Computes the extremes values (min/max vectors) which will be used to compute the inital hull.</p>
|
|
|
|
|
|
+ <h3>[method:Boolean intersectsRay]( [param:Ray ray] )</h3>
|
|
|
|
+ [page:Ray ray] - The given ray.<br /><br />
|
|
|
|
|
|
- <h3>[method:QuickHull computeInitialHull]()</h3>
|
|
|
|
|
|
+ <p>Returns *true* if the given ray intersects with this convex hull.</p>
|
|
|
|
|
|
- <p>Computes the initial simplex assigning to its faces all the points that are candidates to form part of the hull.</p>
|
|
|
|
-
|
|
|
|
- <h3>[method:QuickHull reindexFaces]()</h3>
|
|
|
|
|
|
+ <h3>[method:ConvexHull makeEmpty]()</h3>
|
|
|
|
|
|
- <p>Removes inactive (e.g. deleted) faces from the internal face list.</p>
|
|
|
|
|
|
+ <p>Makes this convex hull empty.</p>
|
|
|
|
|
|
<h3>[method:VertexNode nextVertexToAdd]()</h3>
|
|
<h3>[method:VertexNode nextVertexToAdd]()</h3>
|
|
|
|
|
|
@@ -127,49 +153,39 @@
|
|
</ul>
|
|
</ul>
|
|
</p>
|
|
</p>
|
|
|
|
|
|
- <h3>[method:QuickHull computeHorizon]( [param:Vector3 eyePoint], [param:HalfEdge crossEdge], [param:Face face], [param:Array horizon] )</h3>
|
|
|
|
- [page:Vector3 eyePoint] - The 3D-coordinates of a point.<br /><br />
|
|
|
|
- [page:HalfEdge crossEdge] - The edge used to jump to the current face.<br /><br />
|
|
|
|
- [page:Face face] - The current face being tested.<br /><br />
|
|
|
|
- [page:Array horizon] - The edges that form part of the horizon in CCW order.<br /><br />
|
|
|
|
|
|
+ <h3>[method:ConvexHull reindexFaces]()</h3>
|
|
|
|
|
|
- <p>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'.</p>
|
|
|
|
|
|
+ <p>Removes inactive (e.g. deleted) faces from the internal face list.</p>
|
|
|
|
|
|
- <h3>[method:HalfEdge addAdjoiningFace]( [param:VertexNode eyeVertex], [param:HalfEdge horizonEdge] )</h3>
|
|
|
|
- [page:VertexNode eyeVertex] - The vertex that is added to the hull.<br /><br />
|
|
|
|
- [page:HalfEdge horizonEdge] - A single edge of the horizon.<br /><br />
|
|
|
|
|
|
+ <h3>[method:VertexNode removeAllVerticesFromFace]( [param:Face face] )</h3>
|
|
|
|
+ [page:Face face] - The given face.<br /><br />
|
|
|
|
|
|
- <p>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</p>
|
|
|
|
|
|
+ <p>Removes all the visible vertices that a given face is able to see which are stored in the 'assigned' vertext list.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull addNewFaces]( [param:VertexNode eyeVertex], [param:HalfEdge horizonEdge] )</h3>
|
|
|
|
- [page:VertexNode eyeVertex] - The vertex that is added to the hull.<br /><br />
|
|
|
|
- [page:HalfEdge horizon] - An array of half-edges that form the horizon.<br /><br />
|
|
|
|
|
|
+ <h3>[method:ConvexHull removeVertexFromFace]( [param:VertexNode vertex], [param:Face face] )</h3>
|
|
|
|
+ [page:VertexNode vertex] - The vertex to remove.<br /><br />
|
|
|
|
+ [page:Face face] - The target face.<br /><br />
|
|
|
|
|
|
- <p>Adds 'horizon.length' faces to the hull, each face will be linked with the horizon opposite face and the face on the left/right.</p>
|
|
|
|
|
|
+ <p>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.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull addVertexToHull]( [param:VertexNode eyeVertex] )</h3>
|
|
|
|
- [page:VertexNode eyeVertex] - The vertex that is added to the hull.<br /><br />
|
|
|
|
|
|
+ <h3>[method:ConvexHull resolveUnassignedPoints]( [param:Array newFaces] )</h3>
|
|
|
|
+ [page:Face newFaces] - An array of new faces.<br /><br />
|
|
|
|
|
|
- <p>Adds a vertex to the hull with the following algorithm
|
|
|
|
- <ul>
|
|
|
|
- <li>Compute the 'horizon' which is a chain of half edges. For an edge to belong to this group it must be the edge connecting a face that can see 'eyeVertex' and a face which cannot see 'eyeVertex'.</li>
|
|
|
|
- <li>All the faces that can see 'eyeVertex' have its visible vertices removed from the assigned vertex list.</li>
|
|
|
|
- <li>A new set of faces is created with each edge of the 'horizon' and 'eyeVertex'. Each face is connected with the opposite horizon face and the face on the left/right.</li>
|
|
|
|
- <li>The vertices removed from all the visible faces are assigned to the new faces if possible.</li>
|
|
|
|
- </ul>
|
|
|
|
- </p>
|
|
|
|
|
|
+ <p>Reassigns as many vertices as possible from the unassigned list to the new faces.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull cleanup]()</h3>
|
|
|
|
|
|
+ <h3>[method:ConvexHull setFromObject]( [param:Object3D object] )</h3>
|
|
|
|
+ [page:Object3D object] - [page:Object3D] to compute the convex hull of.<br /><br />
|
|
|
|
|
|
- <p>Cleans up internal properties after computing the convex hull.</p>
|
|
|
|
|
|
+ <p>Computes the convex hull of an [page:Object3D] (including its children),
|
|
|
|
+ accounting for the world transforms of both the object and its childrens.</p>
|
|
|
|
|
|
- <h3>[method:QuickHull compute]()</h3>
|
|
|
|
|
|
+ <h3>[method:ConvexHull setFromPoints]( [param:Array points] )</h3>
|
|
|
|
+ [page:Array points] - Array of [page:Vector3 Vector3s] that the resulting convex hull will contain.<br /><br />
|
|
|
|
|
|
- <p>Starts the execution of the quick hull algorithm.</p>
|
|
|
|
|
|
+ <p>Computes to convex hull for the given array of points.</p>
|
|
|
|
|
|
<h2>Source</h2>
|
|
<h2>Source</h2>
|
|
|
|
|
|
- [link:https://github.com/mrdoob/three.js/blob/master/examples/js/QuickHull.js examples/js/QuickHull.js]
|
|
|
|
|
|
+ [link:https://github.com/mrdoob/three.js/blob/master/examples/js/math/ConvexHull.js examples/js/ConvexHull.js]
|
|
</body>
|
|
</body>
|
|
</html>
|
|
</html>
|