Sphere.html 4.6 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="../../../" />
M
Mr.doob 已提交
6 7 8
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
9 10 11
	</head>
	<body>
		<h1>[name]</h1>
M
Mr.doob 已提交
12

13
		<p class="desc">A sphere defined by a center and radius.</p>
M
Mr.doob 已提交
14

15
		<h2>Constructor</h2>
16
		<h3>[name]( [param:Vector3 center], [param:Float radius] )</h3>
17
		<p>
L
Lewy Blue 已提交
18 19 20 21 22
		[page:Vector3 center] - center of the sphere. Default is a [page:Vector3] at (0, 0, 0). <br />
		[page:Float radius] - radius of the sphere. Default is 0.<br /><br />

		Creates a new [name].

23
		</p>
M
Mr.doob 已提交
24

M
Mr.doob 已提交
25

26
		<h2>Properties</h2>
M
Mr.doob 已提交
27 28


29
		<h3>[property:Vector3 center]</h3>
30
		<p>A [page:Vector3] defining the center of the sphere. Default is (0, 0, 0).</p>
M
Mr.doob 已提交
31

32
		<h3>[property:Float radius]</h3>
33
		<p>The radius of the sphere. Default is 0.</p>
M
Mr.doob 已提交
34

35
		<h2>Methods</h2>
M
Mr.doob 已提交
36

37
		<h3>[method:Sphere applyMatrix4]( [param:Matrix4 matrix] )</h3>
38
		<p>
L
Lewy Blue 已提交
39
			[page:Matrix4 matrix] - the [Page:Matrix4] to apply <br /><br />
C
cjshannon 已提交
40

L
Lewy Blue 已提交
41
			Transforms this sphere with the provided [page:Matrix4].
42
		</p>
C
cjshannon 已提交
43

W
WestLangley 已提交
44
		<h3>[method:Vector3 clampPoint]( [param:Vector3 point], [param:Vector3 target] )</h3>
45
		<p>
L
Lewy Blue 已提交
46
		[page:Vector3 point] - [page:Vector3] The point to clamp.<br />
W
WestLangley 已提交
47
		[page:Vector3 target] — the result will be copied into this Vector3.<br /><br />
C
cjshannon 已提交
48

L
Lewy Blue 已提交
49 50
		Clamps a point within the sphere. If the point is is outside the sphere, it will clamp it to the
		closets point on the edge of the sphere. Points already inside the sphere will not be affected.
51
		</p>
C
cjshannon 已提交
52

53
		<h3>[method:Sphere clone]()</h3>
54
		<p>Returns a new sphere with the same [page:.center center] and [page:.radius radius] as this one.</p>
C
cjshannon 已提交
55

56
		<h3>[method:Boolean containsPoint]( [param:Vector3 point] )</h3>
57
		<p>
L
Lewy Blue 已提交
58
		[page:Vector3 point] - the [page:Vector3] to be checked<br /><br />
C
cjshannon 已提交
59

L
Lewy Blue 已提交
60 61
		Checks to see if the sphere contains the provided [page:Vector3 point] inclusive of the
		surface of the sphere.
62
		</p>
L
Lewy Blue 已提交
63

64
		<h3>[method:Sphere copy]( [param:Sphere sphere] )</h3>
65
		<p>
L
Lewy Blue 已提交
66 67
		Copies the values of the passed sphere's [page:.center center] and [page:.radius radius]
		properties to this sphere.
68
		</p>
C
cjshannon 已提交
69

70
		<h3>[method:Float distanceToPoint]( [param:Vector3 point] )</h3>
71
		<p>
L
Lewy Blue 已提交
72 73
		Returns the closest distance from the boundary of the sphere to the [page:Vector3 point]. If the sphere contains the point,
		the distance will be negative.
74
		</p>
C
cjshannon 已提交
75

L
Lewy Blue 已提交
76
		<h3>[method:Boolean empty]()</h3>
77
		<p>Checks to see if the sphere is empty (the radius set to 0).</p>
C
cjshannon 已提交
78

79
		<h3>[method:Boolean equals]( [param:Sphere sphere] )</h3>
80
		<p>
L
Lewy Blue 已提交
81
		Checks to see if the two spheres' centers and radii are equal.
82
		</p>
L
Lewy Blue 已提交
83

W
WestLangley 已提交
84
		<h3>[method:Box3 getBoundingBox]( [param:Box3 target] )</h3>
85
		<p>
W
WestLangley 已提交
86
		[page:Box3 target] — the result will be copied into this Box3.<br /><br />
L
Lewy Blue 已提交
87

W
WestLangley 已提交
88
		Returns a[link:https://en.wikipedia.org/wiki/Minimum_bounding_box Minimum Bounding Box] for the sphere.
89
		</p>
C
cjshannon 已提交
90

91
		<h3>[method:Boolean intersectsBox]( [param:Box3 box] )</h3>
92
		<p>
L
Lewy Blue 已提交
93 94 95
		[page:Box3 box] - [page:Box3] to check for intersection against.<br /><br />

		Determines whether or not this sphere intersects a given [page:Box3 box].
96
		</p>
L
Lewy Blue 已提交
97

98
		<h3>[method:Boolean intersectsPlane]( [param:Plane plane] )</h3>
99
		<p>
L
Lewy Blue 已提交
100 101 102
		[page:Plane plane] - Plane to check for intersection against.<br /><br />

		Determines whether or not this sphere intersects a given [page:Plane plane].
103
		</p>
C
cjshannon 已提交
104

105
		<h3>[method:Boolean intersectsSphere]( [param:Sphere sphere] )</h3>
106
		<p>
L
Lewy Blue 已提交
107 108
		[page:Sphere sphere] - Sphere to check for intersection against.<br /><br />

G
Greg Tatum 已提交
109
		Checks to see if two spheres intersect.
110
		</p>
C
cjshannon 已提交
111

112
		<h3>[method:Sphere set]( [param:Vector3 center], [param:Float radius] )</h3>
113
		<p>
L
Lewy Blue 已提交
114 115
			[page:Vector3 center] - center of the sphere.<br />
			[page:Float radius] - radius of the sphere.<br /><br />
A
aardgoose 已提交
116

L
Lewy Blue 已提交
117
		Sets the [page:.center center] and [page:.radius radius] properties of this sphere.
118
		</p>
L
Lewy Blue 已提交
119

120
		<h3>[method:Sphere setFromPoints]( [param:Array points], [param:Vector3 optionalCenter] )</h3>
121
		<p>
L
Lewy Blue 已提交
122 123 124 125 126 127
		[page:Array points] - an [page:Array] of [page:Vector3] positions.<br />
		[page:Vector3 optionalCenter] - Optional [page:Vector3] position for the sphere's center.<br /><br />

		Computes the minimum bounding sphere for an array of [page:Array points]. If  [page:Vector3 optionalCenter]is given,
		it is used as the sphere's center. Otherwise, the center of the axis-aligned bounding box encompassing
		[page:Array points] is calculated.
128
		</p>
A
aardgoose 已提交
129

130
		<h3>[method:Sphere translate]( [param:Vector3 offset] )</h3>
131
		<p>
L
Lewy Blue 已提交
132
		Translate the sphere's center by the provided offset [page:Vector3].
133
		</p>
C
cjshannon 已提交
134

135
		<h2>Source</h2>
M
Mr.doob 已提交
136

M
Mugen87 已提交
137 138 139
		<p>
			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
		</p>
140 141
	</body>
</html>