1 | <!DOCTYPE html>
|
---|
2 | <html lang="en">
|
---|
3 | <head>
|
---|
4 | <meta charset="utf-8" />
|
---|
5 | <script src="../../list.js"></script>
|
---|
6 | <script src="../../page.js"></script>
|
---|
7 | <link type="text/css" rel="stylesheet" href="../../page.css" />
|
---|
8 | </head>
|
---|
9 | <body>
|
---|
10 | <h1>[name]</h1>
|
---|
11 |
|
---|
12 | <div class="desc">4D vector.</div>
|
---|
13 |
|
---|
14 |
|
---|
15 | <h2>Constructor</h2>
|
---|
16 |
|
---|
17 |
|
---|
18 | <h3>[name]( [page:Float x], [page:Float y], [page:Float z], [page:Float w] )</h3>
|
---|
19 | <div>
|
---|
20 | x -- [page:Float] <br />
|
---|
21 | y -- [page:Float] <br />
|
---|
22 | z -- [page:Float] <br />
|
---|
23 | w -- [page:Float]
|
---|
24 | </div>
|
---|
25 |
|
---|
26 |
|
---|
27 | <h2>Properties</h2>
|
---|
28 |
|
---|
29 | <h3>.[page:Float x]</h3>
|
---|
30 |
|
---|
31 | <h3>.[page:Float y]</h3>
|
---|
32 |
|
---|
33 | <h3>.[page:Float z]</h3>
|
---|
34 |
|
---|
35 | <h3>.[page:Float w]</h3>
|
---|
36 |
|
---|
37 |
|
---|
38 | <h2>Methods</h2>
|
---|
39 |
|
---|
40 | <h3>.set( [page:Float x], [page:Float y], [page:Float z], [page:Float w] ) [page:Vector4 this]</h3>
|
---|
41 | <div>
|
---|
42 | Sets value of this vector.
|
---|
43 | </div>
|
---|
44 |
|
---|
45 | <h3>.copy( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
---|
46 | <div>
|
---|
47 | Copies value of *v* to this vector.
|
---|
48 | </div>
|
---|
49 |
|
---|
50 | <h3>.add( [page:Vector4 v] ) [page:Vector4 this]</h3>
|
---|
51 | <div>
|
---|
52 | Adds *v* to this vector.
|
---|
53 | </div>
|
---|
54 |
|
---|
55 | <h3>.addVectors( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]</h3>
|
---|
56 | <div>
|
---|
57 | Sets this vector to *a + b*.
|
---|
58 | </div>
|
---|
59 |
|
---|
60 | <h3>.sub( [page:Vector4 v] ) [page:Vector4]</h3>
|
---|
61 | <div>
|
---|
62 | Subtracts *v* from this vector.
|
---|
63 | </div>
|
---|
64 |
|
---|
65 | <h3>.subVectors( [page:Vector4 a], [page:Vector4 b] ) [page:Vector4 this]</h3>
|
---|
66 | <div>
|
---|
67 | Sets this vector to *a - b*.
|
---|
68 | </div>
|
---|
69 |
|
---|
70 | <h3>.multiplyScalar( [page:Float s] ) [page:Vector4 this]</h3>
|
---|
71 | <div>
|
---|
72 | Multiplies this vector by scalar *s*.
|
---|
73 | </div>
|
---|
74 |
|
---|
75 | <h3>.divideScalar( [page:Float s] ) [page:Vector4 this]</h3>
|
---|
76 | <div>
|
---|
77 | Divides this vector by scalar *s*.<br />
|
---|
78 | Set vector to *( 0, 0, 0 )* if *s == 0*.
|
---|
79 | </div>
|
---|
80 |
|
---|
81 | <h3>.negate() [page:Vector4 this]</h3>
|
---|
82 | <div>
|
---|
83 | Inverts this vector.
|
---|
84 | </div>
|
---|
85 |
|
---|
86 | <h3>.dot( [page:Vector4 v] ) [page:Float]</h3>
|
---|
87 | <div>
|
---|
88 | Computes dot product of this vector and *v*.
|
---|
89 | </div>
|
---|
90 |
|
---|
91 | <h3>.lengthSq() [page:Float]</h3>
|
---|
92 | <div>
|
---|
93 | Computes squared length of this vector.
|
---|
94 | </div>
|
---|
95 |
|
---|
96 | <h3>.length() [page:Float]</h3>
|
---|
97 | <div>
|
---|
98 | Computes length of this vector.
|
---|
99 | </div>
|
---|
100 |
|
---|
101 | <h3>.normalize() [page:Vector4 this]</h3>
|
---|
102 | <div>
|
---|
103 | Normalizes this vector.
|
---|
104 | </div>
|
---|
105 |
|
---|
106 | <h3>.setLength( [page:Float l] ) [page:Vector4 this]</h3>
|
---|
107 | <div>
|
---|
108 | Normalizes this vector and multiplies it by *l*.
|
---|
109 | </div>
|
---|
110 |
|
---|
111 | <h3>.lerp( [page:Vector4 v], [page:Float alpha] ) [page:Vector4 this]</h3>
|
---|
112 | <div>
|
---|
113 | Linearly interpolate between this vector and *v* with *alpha* factor.
|
---|
114 | </div>
|
---|
115 |
|
---|
116 | <h3>.clone() [page:Vector4]</h3>
|
---|
117 | <div>
|
---|
118 | Clones this vector.
|
---|
119 | </div>
|
---|
120 |
|
---|
121 |
|
---|
122 | <h3>.clamp([page:Vector4 min], [page:Vector4 max]) [page:Vector4 this]</h3>
|
---|
123 | <div>
|
---|
124 | min -- [page:Vector4] <br />
|
---|
125 | max -- [page:Vector4]
|
---|
126 | </div>
|
---|
127 | <div>
|
---|
128 | If this vector's x, y, z, or w value is greater than the max vector's x, y, z, or w value, it is replaced by the corresponding value.<br/><br/>
|
---|
129 |
|
---|
130 | If this vector's x, y, z, or w value is less than the min vector's x, y, z, or w value, it is replace by the corresponding value.
|
---|
131 | </div>
|
---|
132 |
|
---|
133 | <h3>.applyMatrix4([page:Matrix4 m]) [page:Vector4 this]</h3>
|
---|
134 | <div>
|
---|
135 | m -- [page:Matrix4]
|
---|
136 | </div>
|
---|
137 | <div>
|
---|
138 | Transforms the vector by the matrix.
|
---|
139 | </div>
|
---|
140 |
|
---|
141 | <h3>.min([page:Vector4 v]) [page:Vector4 this]</h3>
|
---|
142 | <div>
|
---|
143 | v -- [page:Vector4]
|
---|
144 | </div>
|
---|
145 | <div>
|
---|
146 | If this vector's x, y, z, or w value is less than vector v's x, y, z, or w value, that value is replaced by the corresponding vector v value.
|
---|
147 | </div>
|
---|
148 |
|
---|
149 | <h3>.max([page:Vector4 v]) [page:Vector4 this]</h3>
|
---|
150 | <div>
|
---|
151 | v -- [page:Vector4]
|
---|
152 | </div>
|
---|
153 | <div>
|
---|
154 | If this vector's x, y, z, or w value is greater than vector v's x, y, z, or w value, that value is replaced by the corresponding vector v value.
|
---|
155 | </div>
|
---|
156 |
|
---|
157 | <h3>.addScalar([page:Float s]) [page:Vector4 this]</h3>
|
---|
158 | <div>
|
---|
159 | s -- [page:Float]
|
---|
160 | </div>
|
---|
161 | <div>
|
---|
162 | Adds a scalar value to all of the vector's components.
|
---|
163 | </div>
|
---|
164 |
|
---|
165 | <h3>.equals([page:Vector4 v]) [page:Boolean]</h3>
|
---|
166 | <div>
|
---|
167 | v -- [page:Vector4]
|
---|
168 | </div>
|
---|
169 | <div>
|
---|
170 | Checks to see if this vector matches vector v.
|
---|
171 | </div>
|
---|
172 |
|
---|
173 | <h3>.setAxisAngleFromRotationMatrix([page:Matrix4 m]) [page:Vector4 this]</h3>
|
---|
174 | <div>
|
---|
175 | m -- [page:Matrix4]
|
---|
176 | </div>
|
---|
177 | <div>
|
---|
178 | Sets this Vector4 to the computed <a href='http://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation' target='_blank'>axis-angle representation</a> of the rotation defined by Matrix4 m. Assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).<br/><br/>
|
---|
179 |
|
---|
180 | The axis is stored in components (x, y, z) of the vector, and the rotation in radians is stored in component w
|
---|
181 | </div>
|
---|
182 |
|
---|
183 | <h3>.setAxisAngleFromQuaternion([page:Quaternion q]) [page:Vector4 this]</h3>
|
---|
184 | <div>
|
---|
185 | q -- [page:Quaternion]
|
---|
186 | </div>
|
---|
187 | <div>
|
---|
188 | Sets this Vector4 to the computed <a href='http://en.wikipedia.org/wiki/Axis%E2%80%93angle_representation' target='_blank'>axis-angle representation</a> of the rotation defined by Quaternion q.<br/><br/>
|
---|
189 |
|
---|
190 | The axis is stored in components (x, y, z) of the vector, and the rotation in radians is stored in component w
|
---|
191 | </div>
|
---|
192 |
|
---|
193 | <h3>.getComponent([page:Integer index]) [page:Float]</h3>
|
---|
194 | <div>
|
---|
195 | index -- [page:Integer] 0, 1, 2, or 3
|
---|
196 | </div>
|
---|
197 | <div>
|
---|
198 | Returns the value of the vector component x, y, or z by an index.<br/><br/>
|
---|
199 |
|
---|
200 | Index 0: x<br/>
|
---|
201 | Index 1: y<br/>
|
---|
202 | Index 2: z<br/>
|
---|
203 | Index 3: w<br/>
|
---|
204 |
|
---|
205 | </div>
|
---|
206 |
|
---|
207 | <h3>.setComponent([page:Integer index], [page:Float value])</h3>
|
---|
208 | <div>
|
---|
209 | index -- [page:Integer] 0 - 3 <br />
|
---|
210 | value -- [page:Float]
|
---|
211 | </div>
|
---|
212 | <div>
|
---|
213 | Sets the value of the vector component x, y, or z by an index.<br/><br/>
|
---|
214 |
|
---|
215 | Index 0: x<br/>
|
---|
216 | Index 1: y<br/>
|
---|
217 | Index 2: z<br/>
|
---|
218 | Index 3: w<br/>
|
---|
219 | </div>
|
---|
220 |
|
---|
221 | <h3>.fromArray([page:Array array]) [page:Vector4 this]</h3>
|
---|
222 | <div>
|
---|
223 | array -- [page:Array] An array formatted [x, y, z, w]
|
---|
224 | </div>
|
---|
225 | <div>
|
---|
226 | Sets the vector's components based on an array formatted like [x, y, z, w]
|
---|
227 | </div>
|
---|
228 |
|
---|
229 | <h3>.toArray() [page:Array]</h3>
|
---|
230 | <div>
|
---|
231 | Returns an array in the format [x, y, z, w]
|
---|
232 | </div>
|
---|
233 |
|
---|
234 | <h3>.lengthManhattan() [page:Float]</h3>
|
---|
235 | <div>
|
---|
236 | Computes Manhattan length of this vector.<br />
|
---|
237 | [link:http://en.wikipedia.org/wiki/Taxicab_geometry]
|
---|
238 | </div>
|
---|
239 |
|
---|
240 |
|
---|
241 | <h3>.setX([page:Float x]) [page:Vector4 this]</h3>
|
---|
242 | <div>
|
---|
243 | x -- [page:Float]
|
---|
244 | </div>
|
---|
245 | <div>
|
---|
246 | Sets the x component of the vector.
|
---|
247 | </div>
|
---|
248 |
|
---|
249 | <h3>.setY([page:Float y]) [page:Vector4 this]</h3>
|
---|
250 | <div>
|
---|
251 | y -- [page:Float]
|
---|
252 | </div>
|
---|
253 | <div>
|
---|
254 | Sets the y component of the vector.
|
---|
255 | </div>
|
---|
256 |
|
---|
257 | <h3>.setZ([page:Float z]) [page:Vector4 this]</h3>
|
---|
258 | <div>
|
---|
259 | z -- [page:Float]
|
---|
260 | </div>
|
---|
261 | <div>
|
---|
262 | Sets the z component of the vector.
|
---|
263 | </div>
|
---|
264 |
|
---|
265 | <h3>.setW([page:Float w]) [page:Vector4 this]</h3>
|
---|
266 | <div>
|
---|
267 | w -- [page:Float]
|
---|
268 | </div>
|
---|
269 | <div>
|
---|
270 | Sets the w component of the vector.
|
---|
271 | </div>
|
---|
272 |
|
---|
273 | <h2>Source</h2>
|
---|
274 |
|
---|
275 | [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
---|
276 | </body>
|
---|
277 | </html>
|
---|