Browse Source

QuickHull3: Docs Part1

Mugen87 8 năm trước cách đây
mục cha
commit
1584938da2

+ 89 - 0
docs/api/math/convexhull/Face.html

@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">
+      Represents a section bounded by a specific amount of half-edges. The current implmentation assumes that a face always consist of three edges.
+		</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]()</h3>
+
+		</div>
+
+		<h2>Properties</h2>
+
+    <h3>[property:Vector3 normal]</h3>
+    <div>
+      The normal vector of the face. Default is a [page:Vector3] at (0, 0, 0).
+    </div>
+
+    <h3>[property:Vector3 midpoint]</h3>
+    <div>
+      The midpoint or centroid of the face. Default is a [page:Vector3] at (0, 0, 0).
+    </div>
+
+    <h3>[property:Float area]</h3>
+    <div>
+      The area of the face. Default is 0.
+    </div>
+
+    <h3>[property:Float constant]</h3>
+    <div>
+      Signed distance from face to the origin. Default is 0.
+    </div>
+
+    <h3>[property:Vertex outside]</h3>
+    <div>
+      Reference to a vertex in a vertex list this face can see. Default is null.
+    </div>
+
+    <h3>[property:Integer mark]</h3>
+    <div>
+      Marks if a face is visible or deleted. Default is 'Visible'.
+    </div>
+
+    <h3>[property:HalfEdge edge]</h3>
+    <div>
+      Reference to the base edge of a face. To retrieve all edges, you can use the 'next' reference of the current edge. Default is null.
+    </div>
+
+    <h2>Methods</h2>
+
+    <h3>[method:Face create]( [page:Vertex a], [page:Vertex b], [page:Vertex c] )</h3>
+    [page:Vertex a] - First vertex of the face.<br /><br />
+    [page:Vertex b] - Second vertex of the face.<br /><br />
+    [page:Vertex c] - Third vertex of the face.<br /><br />
+
+    <div>Creates a face.</div>
+
+    <h3>[method:HalfEdge getEdge]( [page:Integer i] )</h3>
+    [page:Integer i] - The index of the edge.<br /><br />
+
+    <div>Returns an edge by the given index.</div>
+
+    <h3>[method:Face compute] ()</h3>
+
+    <div>Computes all properties of the face.</div>
+
+    <h3>[method:Float distanceToPoint]( [page:Vector3 point] )</h3>
+    [page:Vector3 point] - Any point in 3D space.<br /><br />
+
+    <div>Returns the signed distance from a given point to the plane representation of this face.</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 79 - 0
docs/api/math/convexhull/HalfEdge.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">
+			The basis for a half-edge data structure, also known as doubly connected edge list (DCEL).<br />
+		</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]( [page:Vertex vertex], [page:Face face] )</h3>
+		[page:Vertex vertex] - [page:Vertex] A reference to its destination vertex.<br /><br />
+		[page:Face face] - [page:Face] A reference to its face.<br />
+
+		</div>
+
+		<h2>Properties</h2>
+
+    <h3>[property:Vertex vertex]</h3>
+    <div>
+      Reference to the destination vertex. The origin vertex can be obtained by querying the destination of its twin, or of the previous half-edge. Default is undefined.
+    </div>
+
+		<h3>[property:HalfEdge prev]</h3>
+		<div>
+			Reference to the previous half-edge of the same face. Default is null.
+		</div>
+
+		<h3>[property:HalfEdge next]</h3>
+		<div>
+			Reference to the next half-edge of the same face. Default is null.
+		</div>
+
+    <h3>[property:HalfEdge twin]</h3>
+    <div>
+      Reference to the twin half-edge to reach the opposite face. Default is null.
+    </div>
+
+		<h3>[property:Face face]</h3>
+		<div>
+			 Each half-edge bounds a single face and thus has a reference to that face. Default is undefined.
+		</div>
+
+    <h2>Methods</h2>
+
+    <h3>[method:Vertex head]()</h3>
+		<div>Returns the destintation vertex.</div>
+
+    <h3>[method:Vertex tail]()</h3>
+    <div>Returns the origin vertex.</div>
+
+    <h3>[method:Float length]()</h3>
+    <div>Returns the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
+		(straight-line length) of the edge.</div>
+
+    <h3>[method:Float lengthSquared]()</h3>
+    <div>Returns the square of the [link:https://en.wikipedia.org/wiki/Euclidean_distance Euclidean length]
+    (straight-line length) of the edge.</div>
+
+    <h3>[method:HalfEdge setTwin]( [page:HalfEdge edge] )</h3>
+    [page:HalfEdge edge] - Any half-edge.<br /><br />
+
+    <div>Sets the twin edge of this half-edge. It also ensures that the twin reference of the given half-edge is correctly set.</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 78 - 0
docs/api/math/convexhull/QuickHull3.html

@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">
+			QuickHull3 infos
+		</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]()</h3>
+
+		</div>
+
+		<h2>Properties</h2>
+
+    <h3>[property:Float tolerance]</h3>
+    <div>
+      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.
+    </div>
+
+		<h3>[property:Array faces]</h3>
+		<div>
+			The generated faces of the convex hull. Default is an empty array.
+		</div>
+
+		<h3>[property:Array newFaces]</h3>
+		<div>
+			This array holds the faces that are generated within a single iteration. Default is an empty array.
+		</div>
+
+		<h3>[property:VertexList assigned]</h3>
+		<div>
+			This [page:VertexList vertex list] holds all vertices that are assigned to a face. Default is an empty vertex list.
+		</div>
+
+		<h3>[property:VertexList unassigned]</h3>
+		<div>
+			This [page:VertexList vertex list] holds all vertices that are not assigned to a face. Default is an empty vertex list.
+		</div>
+
+		<h3>[property:Array vertices]</h3>
+		<div>
+			The internal representation of the given geometry data (an array of [page:Vertex vertices]).
+		</div>
+
+    <h2>Methods</h2>
+
+    <h3>[method:QuickHull3 setFromPoints]( [page:Array points] )</h3>
+    [page:Array points] - Array of [page:Vector3 Vector3s] that the resulting convex hull will contain.<br /><br />
+
+    <div>Computes to convex hull for the given array of points.</div>
+
+    <h3>[method:QuickHull3 setFromObject]( [page:Object3D object] )</h3>
+    [page:Object3D object] - [page:Object3D] to compute the convex hull of.<br /><br />
+
+    <div>Computes the convex hull of an [page:Object3D] (including its children),
+		accounting for the world transforms of both the object and its childrens.</div>
+
+    <h3>[method:QuickHull3 makeEmpty]()</h3>
+
+    <div>Makes this convex hull empty.</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 52 - 0
docs/api/math/convexhull/Vertex.html

@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">
+			A vertex as a double linked list node.
+		</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]( [page:Vector3 point] )</h3>
+		[page:Vector3 point] - [page:Vector3] A point (x, y, z) in 3D space.<br /><br />
+
+		</div>
+
+		<h2>Properties</h2>
+
+    <h3>[property:Vector3 point]</h3>
+    <div>
+      A point (x, y, z) in 3D space. Default is undefined.
+    </div>
+
+		<h3>[property:Vertex prev]</h3>
+		<div>
+			Reference to the previous vertex in the double linked list. Default is null.
+		</div>
+
+		<h3>[property:Vertex next]</h3>
+		<div>
+			Reference to the next vertex in the double linked list. Default is null.
+		</div>
+
+		<h3>[property:Face face]</h3>
+		<div>
+			Reference to the face that is able to see this vertex. Default is undefined.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 89 - 0
docs/api/math/convexhull/VertexList.html

@@ -0,0 +1,89 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">
+			A doubly linked list of vertices.
+		</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]()</h3>
+
+		</div>
+
+		<h2>Properties</h2>
+
+    <h3>[property:Vertex head]</h3>
+    <div>
+      Reference to the first vertex of the linked list. Default is null.
+    </div>
+
+		<h3>[property:Vertex tail]</h3>
+		<div>
+			Reference to the last vertex of the linked list. Default is null.
+		</div>
+
+    <h2>Methods</h2>
+
+    <h3>[method:Vertex first]()</h3>
+		<div>Returns the head reference.</div>
+
+    <h3>[method:Vertex last]()</h3>
+    <div>Returns the tail reference.</div>
+
+    <h3>[method:VertexList clear]()</h3>
+    <div>Clears the linked list.</div>
+
+    <h3>[method:VertexList insertBefore]( [page:Vertex target], [page:Vertex vertex] )</h3>
+    [page:Vertex target] - The target vertex. It's assumed that this vertex belongs to the linked list.<br /><br />
+    [page:Vertex vertex] - The vertex to insert.<br /><br />
+
+    <div>Inserts a vertex <strong>before</strong> a target vertex.</div>
+
+		<h3>[method:VertexList insertAfter]( [page:Vertex target], [page:Vertex vertex] )</h3>
+		[page:Vertex target] - The target vertex. It's assumed that this vertex belongs to the linked list.<br /><br />
+		[page:Vertex vertex] - The vertex to insert.<br /><br />
+
+		<div>Inserts a vertex <strong>after</strong> a target vertex.</div>
+
+		<h3>[method:VertexList append]( [page:Vertex vertex] )</h3>
+		[page:Vertex vertex] - The vertex to append.<br /><br />
+
+		<div>Appends a vertex to the end of the linked list.</div>
+
+		<h3>[method:VertexList appendChain]( [page:Vertex vertex] )</h3>
+		[page:Vertex vertex] - The head vertex of a chain of vertices.<br /><br />
+
+		<div>Appends a chain of vertices where the given vertex is the head.</div>
+
+		<h3>[method:VertexList remove]( [page:Vertex vertex] )</h3>
+		[page:Vertex vertex] - The vertex to remove.<br /><br />
+
+		<div>Removes a vertex from the linked list.</div>
+
+		<h3>[method:VertexList removeSubList]( [page:Vertex a], [page:Vertex b] )</h3>
+		[page:Vertex a] - The head of the sublist.<br /><br />
+		[page:Vertex b] - The tail of the sublist.<br /><br />
+
+		<div>Removes a sublist of vertices from the linked list.</div>
+
+		<h3>[method:Boolean isEmpty]()</h3>
+
+		<div>Returns true if the linked list is empty.</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 8 - 0
docs/list.js

@@ -282,6 +282,14 @@ var list = {
 			[ "QuaternionLinearInterpolant", "api/math/interpolants/QuaternionLinearInterpolant" ]
 		],
 
+		"Math / Convex Hull": [
+			[ "Face", "api/math/convexhull/Face" ],
+			[ "HalfEdge", "api/math/convexhull/HalfEdge" ],
+			[ "QuickHull3", "api/math/convexhull/QuickHull3" ],
+			[ "Vertex", "api/math/convexhull/Vertex" ],
+			[ "VertexList", "api/math/convexhull/VertexList" ]
+		],
+
 		"Objects": [
 			[ "Bone", "api/objects/Bone" ],
 			[ "Group", "api/objects/Group" ],

+ 1 - 1
src/math/convexhull/Face.js

@@ -15,7 +15,7 @@ function Face() {
   this.area = 0;
 
   this.constant = 0; // signed distance from face to the origin
-  this.outside = null; // reference to the a vertex in a vertex list this face can see
+  this.outside = null; // reference to a vertex in a vertex list this face can see
   this.mark = Visible;
   this.edge = null;
 

+ 2 - 2
src/math/convexhull/HalfEdge.js

@@ -8,10 +8,10 @@
 function HalfEdge( vertex, face ) {
 
   this.vertex = vertex;
-  this.face = face;
-  this.next = null;
   this.prev = null;
+  this.next = null;
   this.twin = null;
+  this.face = face;
 
 }
 

+ 1 - 1
src/math/convexhull/QuickHull3.js

@@ -16,7 +16,7 @@ function QuickHull3() {
 	this.tolerance = - 1;
 
 	this.faces = []; // the generated faces of the convex hull
-	this.newFaces = []; // this array holds the faces that are generated in a single iteration
+	this.newFaces = []; // this array holds the faces that are generated within a single iteration
 
 	this.assigned = new VertexList();
 	this.unassigned = new VertexList();

+ 3 - 3
src/math/convexhull/Vertex.js

@@ -1,16 +1,16 @@
 /**
  * @author Mugen87 / https://github.com/Mugen87
  *
- * A vertex is a double linked list node.
+ * A vertex as a double linked list node.
  *
  */
 
 function Vertex( point ) {
 
   this.point = point;
-  this.next = null;
   this.prev = null;
-  this.face = null; // the face that is able to see this point
+  this.next = null;
+  this.face = null; // the face that is able to see this vertex
 
 }
 

+ 4 - 4
src/math/convexhull/VertexList.js

@@ -32,7 +32,7 @@ Object.assign( VertexList.prototype, {
 
 	},
 
-  // Inserts a vertex before a 'target' vertex
+  // Inserts a vertex before the target vertex
 
 	insertBefore: function ( target, vertex ) {
 
@@ -55,7 +55,7 @@ Object.assign( VertexList.prototype, {
 
 	},
 
-  // Inserts a vertex after a 'target' vertex
+  // Inserts a vertex after the target vertex
 
   insertAfter: function ( target, vertex ) {
 
@@ -78,7 +78,7 @@ Object.assign( VertexList.prototype, {
 
   },
 
-  // Appends a vertex to the end of this doubly linked list
+  // Appends a vertex to the end of the linked list
 
   append: function ( vertex ) {
 
@@ -131,7 +131,7 @@ Object.assign( VertexList.prototype, {
 
   },
 
-  // Deletes a vertex from this linked list
+  // Removes a vertex from the linked list
 
   remove: function ( vertex ) {