Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ConvexGeometry based on QuickHull #10987

Merged
merged 23 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions docs/examples/geometries/ConvexBufferGeometry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="../../" />
<script src="list.js"></script>
<script src="page.js"></script>
<script src="page.js"></script>
<link type="text/css" rel="stylesheet" href="page.css" />
</head>
<body>
[page:BufferGeometry] &rarr;

<h1>[name]</h1>

<div class="desc">[name] can be used to generate a convex hull for a given array of 3D points.
The average time complexity for this task is considered to be O(nlog(n)).</div>

<script>

// iOS iframe auto-resize workaround

if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {

var scene = document.getElementById( 'scene' );

scene.style.width = getComputedStyle( scene ).width;
scene.style.height = getComputedStyle( scene ).height;
scene.setAttribute( 'scrolling', 'no' );

}

</script>

<h2>Example</h2>

<code>var geometry = new THREE.ConvexBufferGeometry( points );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
var mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
</code>

<h2>Constructor</h2>

<h3>[name]( [page:Array points] )</h3>
<div>
points — Array of [page:Vector3 Vector3s] that the resulting convex hull will contain.
</div>


<h2>Source</h2>

[link:/~https://github.com/mrdoob/three.js/blob/master/examples/js/geometries/ConvexGeometry.js examples/js/geometries/ConvexGeometry.js]
</body>
</html>
54 changes: 54 additions & 0 deletions docs/examples/geometries/ConvexGeometry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<!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>
[page:Geometry] &rarr;

<h1>[name]</h1>

<div class="desc">[name] can be used to generate a convex hull for a given array of 3D points.
The average time complexity for this task is considered to be O(nlog(n)).</div>

<script>

// iOS iframe auto-resize workaround

if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {

var scene = document.getElementById( 'scene' );

scene.style.width = getComputedStyle( scene ).width;
scene.style.height = getComputedStyle( scene ).height;
scene.setAttribute( 'scrolling', 'no' );

}

</script>

<h2>Example</h2>

<code>var geometry = new THREE.ConvexGeometry( points );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
var mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
</code>

<h2>Constructor</h2>

<h3>[name]( [page:Array points] )</h3>
<div>
points — Array of [page:Vector3 Vector3s] that the resulting convex hull will contain.
</div>


<h2>Source</h2>

[link:/~https://github.com/mrdoob/three.js/blob/master/examples/js/geometries/ConvexGeometry.js examples/js/geometries/ConvexGeometry.js]
</body>
</html>
89 changes: 89 additions & 0 deletions docs/examples/quickhull/Face.html
Original file line number Diff line number Diff line change
@@ -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:VertexNode 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:VertexNode a], [page:VertexNode b], [page:VertexNode c] )</h3>
[page:VertexNode a] - First vertex of the face.<br /><br />
[page:VertexNode b] - Second vertex of the face.<br /><br />
[page:VertexNode 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/examples/js/QuickHull.js examples/js/QuickHull.js]
</body>
</html>
79 changes: 79 additions & 0 deletions docs/examples/quickhull/HalfEdge.html
Original file line number Diff line number Diff line change
@@ -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:VertexNode vertex], [page:Face face] )</h3>
[page:VertexNode vertex] - [page:VertexNode] 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:VertexNode 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:VertexNode head]()</h3>
<div>Returns the destintation vertex.</div>

<h3>[method:VertexNode 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/examples/js/QuickHull.js examples/js/QuickHull.js]
</body>
</html>
Loading