@@ -32,7 +32,7 @@ class AVector {
32
32
33
33
normalize ( ) {
34
34
const { length } = this ;
35
- return this . createVector ( this . x / length , this . y / length , this . z / length ) ;
35
+ return new this . constructor ( this . x / length , this . y / length , this . z / length ) ;
36
36
}
37
37
38
38
norm ( ) {
@@ -47,7 +47,7 @@ class AVector {
47
47
}
48
48
49
49
cross ( v ) {
50
- return this . createVector (
50
+ return new this . constructor (
51
51
this . y * v . z - this . z * v . y ,
52
52
this . z * v . x - this . x * v . z ,
53
53
this . x * v . y - this . y * v . x
@@ -86,13 +86,12 @@ class AVector {
86
86
x : qx , y : qy , z : qz , w : qw
87
87
} = quat ;
88
88
89
- // q*v
90
89
const ix = qw * x + qy * z - qz * y ;
91
90
const iy = qw * y + qz * x - qx * z ;
92
91
const iz = qw * z + qx * y - qy * x ;
93
92
const iw = - qx * x - qy * y - qz * z ;
94
93
95
- return this . createVector (
94
+ return new this . constructor (
96
95
ix * qw + iw * - qx + iy * - qz - iz * - qy ,
97
96
iy * qw + iw * - qy + iz * - qx - ix * - qz ,
98
97
iz * qw + iw * - qz + ix * - qy - iy * - qx
@@ -180,10 +179,6 @@ export class Vector extends AVector {
180
179
clone ( ) {
181
180
return new Vector ( this . x , this . y , this . z ) ;
182
181
}
183
-
184
- createVector ( x , y , z ) {
185
- return new Vector ( x , y , z ) ;
186
- }
187
182
}
188
183
189
184
export class Victor extends AVector {
@@ -214,10 +209,6 @@ export class Victor extends AVector {
214
209
toVector ( ) {
215
210
return new Vector ( this . x , this . y , this . z ) ;
216
211
}
217
-
218
- createVector ( x , y , z ) {
219
- return new Victor ( x , y , z ) ;
220
- }
221
212
}
222
213
223
214
export function calc ( alg ) {
0 commit comments