Vector3.html 3.7 KB
Newer Older
1 2 3
<!DOCTYPE html>
<html lang="en">
	<head>
4
		<meta charset="utf-8" />
5 6 7 8 9 10
		<script src="../../list.js"></script>
		<script src="../../page.js"></script>
		<link type="text/css" rel="stylesheet" href="../../page.css" />
	</head>
	<body>
		<h1>[name]</h1>
M
Mr.doob 已提交
11

12
		<div class="desc">3D vector.</div>
M
Mr.doob 已提交
13 14


15
		<h2>Example</h2>
M
Mr.doob 已提交
16

17 18
		<code>var a = new THREE.Vector3( 1, 0, 0 );
		var b = new THREE.Vector3( 0, 1, 0 );
M
Mr.doob 已提交
19

20
		var c = new THREE.Vector3();
21
		c.crossVectors( a, b );
22
		</code>
M
Mr.doob 已提交
23 24


25
		<h2>Constructor</h2>
M
Mr.doob 已提交
26

27
		<h3>[name]( [page:Float x], [page:Float y], [page:Float z] )</h3>
M
Mr.doob 已提交
28 29


30
		<h2>Properties</h2>
M
Mr.doob 已提交
31

32
		<h3>.[page:Float x]</h3>
M
Mr.doob 已提交
33

34
		<h3>.[page:Float y]</h3>
M
Mr.doob 已提交
35

36
		<h3>.[page:Float z]</h3>
M
Mr.doob 已提交
37 38


39
		<h2>Methods</h2>
M
Mr.doob 已提交
40

41 42 43 44
		<h3>.set( [page:Float x], [page:Float y], [page:Float z] ) [page:Vector3]</h3>
		<div>
		Sets value of this vector.
		</div>
M
Mr.doob 已提交
45

46 47 48 49
		<h3>.setX( [page:Float x] ) [page:Vector3]</h3>
		<div>
		Sets x value of this vector.
		</div>
M
Mr.doob 已提交
50

51 52 53 54
		<h3>.setY( [page:Float y] ) [page:Vector3]</h3>
		<div>
		Sets y value of this vector.
		</div>
M
Mr.doob 已提交
55

56 57 58 59 60 61 62 63 64 65
		<h3>.setZ( [page:Float z] ) [page:Vector3]</h3>
		<div>
		Sets z value of this vector.
		</div>

		<h3>.copy( [page:Vector3 v] ) [page:Vector3]</h3>
		<div>
		Copies value of *v* to this vector.
		</div>

66
		<h3>.add( [page:Vector3 v] ) [page:Vector3]</h3>
67
		<div>
68
		Adds *v* to this vector.
69 70
		</div>

71
		<h3>.addVectors( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
72
		<div>
73
		Sets this vector to *a + b*.
74 75
		</div>

76
		<h3>.sub( [page:Vector3 v] ) [page:Vector3]</h3>
77
		<div>
78
		Subtracts *v* from this vector.
79 80
		</div>

81
		<h3>.subVectors( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
82
		<div>
83
		Sets this vector to *a - b*.
84 85 86 87 88 89
		</div>

		<h3>.multiplyScalar( [page:Float s] ) [page:Vector3]</h3>
		<div>
		Multiplies this vector by scalar *s*.
		</div>
M
Mr.doob 已提交
90

91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
		<h3>.divideScalar( [page:Float s] ) [page:Vector3]</h3>
		<div>
		Divides this vector by scalar *s*.<br />
		Set vector to *( 0, 0, 0 )* if *s == 0*.
		</div>

		<h3>.negate() [page:Vector3]</h3>
		<div>
		Inverts this vector.
		</div>

		<h3>.dot( [page:Vector3 v] ) [page:Float]</h3>
		<div>
		Computes dot product of this vector and *v*.
		</div>
M
Mr.doob 已提交
106

107 108 109 110
		<h3>.lengthSq() [page:Float]</h3>
		<div>
		Computes squared length of this vector.
		</div>
M
Mr.doob 已提交
111

112 113 114 115
		<h3>.length() [page:Float]</h3>
		<div>
		Computes length of this vector.
		</div>
M
Mr.doob 已提交
116

117 118 119 120 121 122 123 124 125 126 127
		<h3>.lengthManhattan() [page:Float]</h3>
		<div>
		Computes Manhattan length of this vector.<br />
		[link:http://en.wikipedia.org/wiki/Taxicab_geometry]
		</div>

		<h3>.normalize() [page:Vector3]</h3>
		<div>
		Normalizes this vector.
		</div>

M
Mr.doob 已提交
128
		<h3>.distanceTo( [page:Vector3 v] ) [page:Float]</h3>
129 130 131 132
		<div>
		Computes distance of this vector to *v*.
		</div>

M
Mr.doob 已提交
133
		<h3>.distanceToSquared( [page:Vector3 v] ) [page:Float]</h3>
134 135 136 137 138 139 140 141 142
		<div>
		Computes squared distance of this vector to *v*.
		</div>

		<h3>.setLength( [page:Float l] ) [page:Vector3]</h3>
		<div>
		Normalizes this vector and multiplies it by *l*.
		</div>

143
		<h3>.cross( [page:Vector3 v] ) [page:Vector3]</h3>
144
		<div>
145
		Sets this vector to cross product of itself and *v*.
146 147
		</div>

148
		<h3>.crossVectors( [page:Vector3 a], [page:Vector3 b] ) [page:Vector3]</h3>
149
		<div>
150
		Sets this vector to cross product of *a* and *b*.
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178
		</div>

		<h3>.getPositionFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
		<div>
		Sets this vector extracting position from matrix transform.
		</div>

		<h3>.getScaleFromMatrix( [page:Matrix4 m] ) [page:Vector3]</h3>
		<div>
		Sets this vector extracting scale from matrix transform.
		</div>

		<h3>.equals( [page:Vector3 v] ) [page:Vector3]</h3>
		<div>
		Checks for strict equality of this vector and *v*.
		</div>

		<h3>.clone() [page:Vector3]</h3>
		<div>
		Clones this vector.
		</div>


		<h2>Source</h2>

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