1 | import { Camera } from "../cameras/Camera.js";
|
2 | import { BufferAttribute } from "../core/BufferAttribute.js";
|
3 | import { InterleavedBufferAttribute } from "../core/InterleavedBufferAttribute.js";
|
4 | import { RGB } from "./Color.js";
|
5 | import { Cylindrical } from "./Cylindrical.js";
|
6 | import { Euler } from "./Euler.js";
|
7 | import { Matrix3 } from "./Matrix3.js";
|
8 | import { Matrix4 } from "./Matrix4.js";
|
9 | import { QuaternionLike } from "./Quaternion.js";
|
10 | import { Spherical } from "./Spherical.js";
|
11 |
|
12 | export type Vector3Tuple = [number, number, number];
|
13 |
|
14 | export interface Vector3Like {
|
15 | readonly x: number;
|
16 | readonly y: number;
|
17 | readonly z: number;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 | export class Vector3 {
|
32 | constructor(x?: number, y?: number, z?: number);
|
33 |
|
34 | /**
|
35 | * @default 0
|
36 | */
|
37 | x: number;
|
38 |
|
39 | /**
|
40 | * @default 0
|
41 | */
|
42 | y: number;
|
43 |
|
44 | /**
|
45 | * @default 0
|
46 | */
|
47 | z: number;
|
48 | readonly isVector3: true;
|
49 |
|
50 | /**
|
51 | * Sets value of this vector.
|
52 | */
|
53 | set(x: number, y: number, z: number): this;
|
54 |
|
55 | /**
|
56 | * Sets all values of this vector.
|
57 | */
|
58 | setScalar(scalar: number): this;
|
59 |
|
60 | /**
|
61 | * Sets x value of this vector.
|
62 | */
|
63 | setX(x: number): this;
|
64 |
|
65 | /**
|
66 | * Sets y value of this vector.
|
67 | */
|
68 | setY(y: number): this;
|
69 |
|
70 | /**
|
71 | * Sets z value of this vector.
|
72 | */
|
73 | setZ(z: number): this;
|
74 |
|
75 | setComponent(index: number, value: number): this;
|
76 |
|
77 | getComponent(index: number): number;
|
78 |
|
79 | /**
|
80 | * Clones this vector.
|
81 | */
|
82 | clone(): this;
|
83 |
|
84 | /**
|
85 | * Copies value of v to this vector.
|
86 | */
|
87 | copy(v: Vector3Like): this;
|
88 |
|
89 | /**
|
90 | * Adds v to this vector.
|
91 | */
|
92 | add(v: Vector3Like): this;
|
93 |
|
94 | addScalar(s: number): this;
|
95 |
|
96 | /**
|
97 | * Sets this vector to a + b.
|
98 | */
|
99 | addVectors(a: Vector3Like, b: Vector3Like): this;
|
100 |
|
101 | addScaledVector(v: Vector3, s: number): this;
|
102 |
|
103 | /**
|
104 | * Subtracts v from this vector.
|
105 | */
|
106 | sub(a: Vector3Like): this;
|
107 |
|
108 | subScalar(s: number): this;
|
109 |
|
110 | /**
|
111 | * Sets this vector to a - b.
|
112 | */
|
113 | subVectors(a: Vector3Like, b: Vector3Like): this;
|
114 |
|
115 | multiply(v: Vector3Like): this;
|
116 |
|
117 | /**
|
118 | * Multiplies this vector by scalar s.
|
119 | */
|
120 | multiplyScalar(s: number): this;
|
121 |
|
122 | multiplyVectors(a: Vector3Like, b: Vector3Like): this;
|
123 |
|
124 | applyEuler(euler: Euler): this;
|
125 |
|
126 | applyAxisAngle(axis: Vector3, angle: number): this;
|
127 |
|
128 | applyMatrix3(m: Matrix3): this;
|
129 |
|
130 | applyNormalMatrix(m: Matrix3): this;
|
131 |
|
132 | applyMatrix4(m: Matrix4): this;
|
133 |
|
134 | applyQuaternion(q: QuaternionLike): this;
|
135 |
|
136 | project(camera: Camera): this;
|
137 |
|
138 | unproject(camera: Camera): this;
|
139 |
|
140 | transformDirection(m: Matrix4): this;
|
141 |
|
142 | divide(v: Vector3Like): this;
|
143 |
|
144 | /**
|
145 | * Divides this vector by scalar s.
|
146 | * Set vector to ( 0, 0, 0 ) if s == 0.
|
147 | */
|
148 | divideScalar(s: number): this;
|
149 |
|
150 | min(v: Vector3Like): this;
|
151 |
|
152 | max(v: Vector3Like): this;
|
153 |
|
154 | clamp(min: Vector3Like, max: Vector3Like): this;
|
155 |
|
156 | clampScalar(min: number, max: number): this;
|
157 |
|
158 | clampLength(min: number, max: number): this;
|
159 |
|
160 | floor(): this;
|
161 |
|
162 | ceil(): this;
|
163 |
|
164 | round(): this;
|
165 |
|
166 | roundToZero(): this;
|
167 |
|
168 | /**
|
169 | * Inverts this vector.
|
170 | */
|
171 | negate(): this;
|
172 |
|
173 | /**
|
174 | * Computes dot product of this vector and v.
|
175 | */
|
176 | dot(v: Vector3Like): number;
|
177 |
|
178 | /**
|
179 | * Computes squared length of this vector.
|
180 | */
|
181 | lengthSq(): number;
|
182 |
|
183 | /**
|
184 | * Computes length of this vector.
|
185 | */
|
186 | length(): number;
|
187 |
|
188 | /**
|
189 | * Computes the Manhattan length of this vector.
|
190 | *
|
191 | * see {@link http:
|
192 | */
|
193 | manhattanLength(): number;
|
194 |
|
195 | |
196 |
|
197 |
|
198 | normalize(): this;
|
199 |
|
200 | |
201 |
|
202 |
|
203 | setLength(l: number): this;
|
204 | lerp(v: Vector3Like, alpha: number): this;
|
205 |
|
206 | lerpVectors(v1: Vector3Like, v2: Vector3Like, alpha: number): this;
|
207 |
|
208 | |
209 |
|
210 |
|
211 | cross(a: Vector3Like): this;
|
212 |
|
213 | |
214 |
|
215 |
|
216 | crossVectors(a: Vector3Like, b: Vector3Like): this;
|
217 | projectOnVector(v: Vector3): this;
|
218 | projectOnPlane(planeNormal: Vector3): this;
|
219 | reflect(vector: Vector3Like): this;
|
220 | angleTo(v: Vector3): number;
|
221 |
|
222 | |
223 |
|
224 |
|
225 | distanceTo(v: Vector3Like): number;
|
226 |
|
227 | |
228 |
|
229 |
|
230 | distanceToSquared(v: Vector3Like): number;
|
231 |
|
232 | |
233 |
|
234 |
|
235 |
|
236 |
|
237 | manhattanDistanceTo(v: Vector3Like): number;
|
238 |
|
239 | setFromSpherical(s: Spherical): this;
|
240 | setFromSphericalCoords(r: number, phi: number, theta: number): this;
|
241 | setFromCylindrical(s: Cylindrical): this;
|
242 | setFromCylindricalCoords(radius: number, theta: number, y: number): this;
|
243 | setFromMatrixPosition(m: Matrix4): this;
|
244 | setFromMatrixScale(m: Matrix4): this;
|
245 | setFromMatrixColumn(matrix: Matrix4, index: number): this;
|
246 | setFromMatrix3Column(matrix: Matrix3, index: number): this;
|
247 |
|
248 | |
249 |
|
250 |
|
251 | setFromEuler(e: Euler): this;
|
252 |
|
253 | |
254 |
|
255 |
|
256 |
|
257 | setFromColor(color: RGB): this;
|
258 |
|
259 | |
260 |
|
261 |
|
262 | equals(v: Vector3Like): boolean;
|
263 |
|
264 | |
265 |
|
266 |
|
267 |
|
268 |
|
269 | fromArray(array: number[] | ArrayLike<number>, offset?: number): this;
|
270 |
|
271 | |
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | toArray(array?: number[], offset?: number): number[];
|
278 | toArray(array?: Vector3Tuple, offset?: 0): Vector3Tuple;
|
279 |
|
280 | |
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 | toArray(array: ArrayLike<number>, offset?: number): ArrayLike<number>;
|
287 |
|
288 | fromBufferAttribute(attribute: BufferAttribute | InterleavedBufferAttribute, index: number): this;
|
289 |
|
290 | |
291 |
|
292 |
|
293 | random(): this;
|
294 |
|
295 | randomDirection(): this;
|
296 |
|
297 | |
298 |
|
299 |
|
300 | [Symbol.iterator](): Iterator<number>;
|
301 | }
|