File size: 3,784 Bytes
6cd9596
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
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
179
180
181
182
183
184
185
186
187
188
import { Matrix4 } from './Matrix4';
import { Quaternion } from './Quaternion';
import { Matrix3 } from './Matrix3';
import { BufferAttribute } from './../core/BufferAttribute';
import { Vector } from './Vector2';

/**
 * @deprecated use {@link Vector3 THREE.Vector3} instead.
 */

/**
 * 4D vector.
 *
 * ( class Vector4 implements Vector<Vector4> )
 */
export class Vector4 implements Vector {
  constructor(x?: number, y?: number, z?: number, w?: number);

  x: number;
  y: number;
  z: number;
  w: number;
  isVector4: true;

  /**
   * Sets value of this vector.
   */
  set(x: number, y: number, z: number, w: number): this;

  /**
   * Sets all values of this vector.
   */
  setScalar(scalar: number): this;

  /**
   * Sets X component of this vector.
   */
  setX(x: number): this;

  /**
   * Sets Y component of this vector.
   */
  setY(y: number): this;

  /**
   * Sets Z component of this vector.
   */
  setZ(z: number): this;

  /**
   * Sets w component of this vector.
   */
  setW(w: number): this;

  setComponent(index: number, value: number): this;

  getComponent(index: number): number;

  /**
   * Clones this vector.
   */
  clone(): this;

  /**
   * Copies value of v to this vector.
   */
  copy(v: Vector4): this;

  /**
   * Adds v to this vector.
   */
  add(v: Vector4, w?: Vector4): this;

  addScalar(scalar: number): this;

  /**
   * Sets this vector to a + b.
   */
  addVectors(a: Vector4, b: Vector4): this;

  addScaledVector(v: Vector4, s: number): this;
  /**
   * Subtracts v from this vector.
   */
  sub(v: Vector4): this;

  subScalar(s: number): this;

  /**
   * Sets this vector to a - b.
   */
  subVectors(a: Vector4, b: Vector4): this;

  /**
   * Multiplies this vector by scalar s.
   */
  multiplyScalar(s: number): this;

  applyMatrix4(m: Matrix4): this;

  /**
   * Divides this vector by scalar s.
   * Set vector to ( 0, 0, 0 ) if s == 0.
   */
  divideScalar(s: number): this;

  /**
   * http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/index.htm
   * @param q is assumed to be normalized
   */
  setAxisAngleFromQuaternion(q: Quaternion): this;

  /**
   * http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToAngle/index.htm
   * @param m assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)
   */
  setAxisAngleFromRotationMatrix(m: Matrix3): this;

  min(v: Vector4): this;
  max(v: Vector4): this;
  clamp(min: Vector4, max: Vector4): this;
  clampScalar(min: number, max: number): this;
  floor(): this;
  ceil(): this;
  round(): this;
  roundToZero(): this;

  /**
   * Inverts this vector.
   */
  negate(): this;

  /**
   * Computes dot product of this vector and v.
   */
  dot(v: Vector4): number;

  /**
   * Computes squared length of this vector.
   */
  lengthSq(): number;

  /**
   * Computes length of this vector.
   */
  length(): number;

  /**
   * Computes the Manhattan length of this vector.
   *
   * @return {number}
   *
   * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry}
   */
  manhattanLength(): number;

  /**
   * Normalizes this vector.
   */
  normalize(): this;
  /**
   * Normalizes this vector and multiplies it by l.
   */
  setLength(length: number): this;

  /**
   * Linearly interpolate between this vector and v with alpha factor.
   */
  lerp(v: Vector4, alpha: number): this;

  lerpVectors(v1: Vector4, v2: Vector4, alpha: number): this;

  /**
   * Checks for strict equality of this vector and v.
   */
  equals(v: Vector4): boolean;

  fromArray(xyzw: number[], offset?: number): this;

  toArray(xyzw?: number[], offset?: number): number[];

  fromBufferAttribute(
    attribute: BufferAttribute,
    index: number,
    offset?: number
  ): this;
}