Skip to content

Commit

Permalink
Re-add Util.getQuaternionAngle, used in debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiasBuelens authored and jsantell committed Dec 7, 2017
1 parent 94fc550 commit 1dc3897
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -478,4 +478,15 @@ Util.getDomainFromUrl = function(url) {
return domain;
}

Util.getQuaternionAngle = function(quat) {
// angle = 2 * acos(qw)
// If w is greater than 1 (THREE.js, how can this be?), arccos is not defined.
if (quat.w > 1) {
console.warn('getQuaternionAngle: w > 1');
return 0;
}
var angle = 2 * Math.acos(quat.w);
return angle;
};

module.exports = Util;

0 comments on commit 1dc3897

Please sign in to comment.