Skip to content

Commit 431901f

Browse files
committed
fix(quaternion): correct return type
1 parent 3571dfa commit 431901f

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

src/quaternion.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,15 @@ class AQuaternion {
166166
}
167167

168168
get left() {
169-
return this.appyVector(LEFT);
169+
return this.multiplyVector(LEFT);
170170
}
171171

172172
get dir() {
173-
return this.appyVector(FORWARD);
173+
return this.multiplyVector(FORWARD);
174174
}
175175

176176
get up() {
177-
return this.appyVector(UP);
177+
return this.multiplyVector(UP);
178178
}
179179

180180
/**
@@ -328,15 +328,15 @@ function fromCache(scope, key, fn) {
328328

329329
export class IQuaternion extends AQuaternion {
330330
get left() {
331-
return fromCache(this, LEFT_CACHE, () => this.appyVector(LEFT));
331+
return fromCache(this, LEFT_CACHE, () => this.multiplyVector(LEFT));
332332
}
333333

334334
get dir() {
335-
return fromCache(this, FORWARD_CACHE, () => this.appyVector(FORWARD));
335+
return fromCache(this, FORWARD_CACHE, () => this.multiplyVector(FORWARD));
336336
}
337337

338338
get up() {
339-
return fromCache(this, UP_CACHE, () => this.appyVector(UP));
339+
return fromCache(this, UP_CACHE, () => this.multiplyVector(UP));
340340
}
341341
}
342342

@@ -392,15 +392,18 @@ const LEFT90 = new IQuaternion(LEFT, degree(90));
392392
* @returns {IQuaternion}
393393
*/
394394
export function fromOrientation({ alpha, beta, gamma }, orientation) {
395-
let rot = new IQuaternion(fromEulerYXZ(degree(beta), degree(alpha), degree(-gamma)));
396-
rot.multiplyQuaternion(LEFT90);
395+
const x = degree(beta);
396+
const y = degree(alpha);
397+
const z = degree(-gamma);
398+
let rot = new IQuaternion(fromEulerYXZ(x, y, z));
399+
rot = rot.multiplyQuaternion(LEFT90);
397400

398401
if (orientation) {
399402
const { dir } = rot;
400403
const local = new IQuaternion(dir, degree(orientation));
401404
rot = local.multiplyQuaternion(rot);
402405
}
403-
return rot[AXES];
406+
return rot;
404407
}
405408

406409
export const Export = {

0 commit comments

Comments
 (0)