File: Shape.html

package info (click to toggle)
three.js 111%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 15,212 kB
  • sloc: javascript: 133,174; makefile: 24; sh: 1
file content (103 lines) | stat: -rw-r--r-- 3,107 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!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:Curve] &rarr; [page:CurvePath] &rarr; [page:Path] &rarr;

		<h1>[name]</h1>

		<p class="desc">
		Defines an arbitrary 2d shape plane using paths with optional holes. It can be used with [page:ExtrudeGeometry],
		[page:ShapeGeometry], to get points, or to get triangulated faces.
		</p>

		<code>
		var heartShape = new THREE.Shape();

		heartShape.moveTo( 25, 25 );
		heartShape.bezierCurveTo( 25, 25, 20, 0, 0, 0 );
		heartShape.bezierCurveTo( 30, 0, 30, 35,30,35 );
		heartShape.bezierCurveTo( 30, 55, 10, 77, 25, 95 );
		heartShape.bezierCurveTo( 60, 77, 80, 55, 80, 35 );
		heartShape.bezierCurveTo( 80, 35, 80, 0, 50, 0 );
		heartShape.bezierCurveTo( 35, 0, 25, 25, 25, 25 );

		var extrudeSettings = { amount: 8, bevelEnabled: true, bevelSegments: 2, steps: 2, bevelSize: 1, bevelThickness: 1 };

		var geometry = new THREE.ExtrudeGeometry( heartShape, extrudeSettings );

		var mesh = new THREE.Mesh( geometry, new THREE.MeshPhongMaterial() );
		</code>

		<h2>Examples</h2>

		<p>
		[example:webgl_geometry_shapes geometry / shapes ]<br/>
		[example:webgl_geometry_extrude_shapes geometry / extrude / shapes ]<br/>
		[example:webgl_geometry_extrude_shapes2 geometry / extrude / shapes2 ]<br/>
		</p>


		<h2>Constructor</h2>


		<h3>[name]( [param:Array points] )</h3>
		<p>
		points -- (optional) array of [page:Vector2 Vector2s].<br /><br />

		Creates a Shape from the points. The first point defines the offset, then successive points
		are added to the [page:CurvePath.curves curves] array as [page:LineCurve LineCurves].<br /><br />

		If no points are specified, an empty shape is created and the [page:.currentPoint] is set to
		the origin.
		</p>


		<h2>Properties</h2>
		<p>See the base [page:Path] class for common properties.</p>

		<h3>[property:String uuid]</h3>
		<p>
		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this instance. This gets automatically assigned, so this shouldn't be edited.
		</p>

		<h3>[property:array holes]</h3>
		<p>An array of [page:Path paths] that define the holes in the shape.</p>

		<h2>Methods</h2>
		<p>See the base [page:Path] class for common methods.</p>

		<h3>[method:Array extractPoints]( [param:Integer divisions] )</h3>
		<p>
		divisions -- The fineness of the result.<br /><br />

		Call [page:Curve.getPoints getPoints] on the shape and the [page:.holes] array, and return an object of the form:
		<code>
{
	shape
	holes
}
		</code>
		where shape and holes are arrays of [page:Vector2 Vector2s].
		</p>

		<h3>[method:Array getPointsHoles]( [param:Integer divisions] )</h3>
		<p>
		divisions -- The fineness of the result.<br /><br />

		Get an array of [page:Vector2 Vector2s] that represent the holes in the shape.
		</p>

		<h2>Source</h2>

		<p>
			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
		</p>
	</body>
</html>