PolyhedronGeometry.html 2.0 KB
Newer Older
1 2 3
<!DOCTYPE html>
<html lang="en">
	<head>
M
Mr.doob 已提交
4
		<meta charset="utf-8" />
M
Mr.doob 已提交
5
		<base href="../../../" />
6 7 8 9 10 11 12 13
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
	</head>
	<body>
		[page:BufferGeometry] &rarr;

		<h1>[name]</h1>

14
		<p class="desc">
15 16
			A polyhedron is a solid in three dimensions with flat faces. This class will take an array of vertices,
			project them onto a sphere, and then divide them up to the desired level of detail. This class is used
M
Mugen87 已提交
17 18
			by [page:DodecahedronGeometry], [page:IcosahedronGeometry], [page:OctahedronGeometry],
			and [page:TetrahedronGeometry] to generate their respective geometries.
19
		</p>
20

M
Mugen87 已提交
21
		<h2>Code Example</h2>
22
<code>
M
Mugen87 已提交
23
const verticesOfCube = [
24 25 26 27
    -1,-1,-1,    1,-1,-1,    1, 1,-1,    -1, 1,-1,
    -1,-1, 1,    1,-1, 1,    1, 1, 1,    -1, 1, 1,
];

M
Mugen87 已提交
28
const indicesOfFaces = [
29 30 31 32 33 34 35 36
    2,1,0,    0,3,2,
    0,4,7,    7,3,0,
    0,1,5,    5,4,0,
    1,2,6,    6,5,1,
    2,3,7,    7,6,2,
    4,5,6,    6,7,4
];

M
Mugen87 已提交
37
const geometry = new THREE.PolyhedronGeometry( verticesOfCube, indicesOfFaces, 6, 2 );
38 39 40 41 42
</code>

		<h2>Constructor</h2>


43
		<h3>[name]([param:Array vertices], [param:Array indices], [param:Float radius], [param:Integer detail])</h3>
44
		<p>
45
		vertices — [page:Array] of points of the form [1,1,1, -1,-1,-1, ... ] <br />
46
		indices — [page:Array] of indices that make up the faces of the form [0,1,2, 2,3,0, ... ] <br />
47 48
		radius — [page:Float] - The radius of the final shape <br />
		detail — [page:Integer] - How many levels to subdivide the geometry. The more detail, the smoother the shape.
49
		</p>
50 51

		<h2>Properties</h2>
M
Mugen87 已提交
52
		<p>See the base [page:BufferGeometry] class for common properties.</p>
53 54

		<h3>[property:Object parameters]</h3>
55
		<p>
56
		An object with a property for each of the constructor parameters. Any modification after instantiation does not change the geometry.
57
		</p>
58

M
Mugen87 已提交
59 60
		<h2>Methods</h2>
		<p>See the base [page:BufferGeometry] class for common methods.</p>
61 62 63

		<h2>Source</h2>

M
Mugen87 已提交
64
		<p>
M
Mr.doob 已提交
65
			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
M
Mugen87 已提交
66
		</p>
67 68
	</body>
</html>