未验证 提交 bb3a5787 编写于 作者: M Mr.doob 提交者: GitHub

Merge pull request #16039 from WestLangley/dev-closure

Quaternion: Remove unneeded closure
......@@ -349,54 +349,48 @@ Object.assign( Quaternion.prototype, {
},
setFromUnitVectors: function () {
setFromUnitVectors: function ( vFrom, vTo ) {
// assumes direction vectors vFrom and vTo are normalized
var r;
var EPS = 0.000001;
return function setFromUnitVectors( vFrom, vTo ) {
r = vFrom.dot( vTo ) + 1;
if ( r < EPS ) {
r = 0;
var r = vFrom.dot( vTo ) + 1;
if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {
if ( r < EPS ) {
this._x = - vFrom.y;
this._y = vFrom.x;
this._z = 0;
this._w = r;
r = 0;
} else {
if ( Math.abs( vFrom.x ) > Math.abs( vFrom.z ) ) {
this._x = 0;
this._y = - vFrom.z;
this._z = vFrom.y;
this._w = r;
}
this._x = - vFrom.y;
this._y = vFrom.x;
this._z = 0;
this._w = r;
} else {
// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
this._x = 0;
this._y = - vFrom.z;
this._z = vFrom.y;
this._w = r;
}
return this.normalize();
} else {
};
// crossVectors( vFrom, vTo ); // inlined to avoid cyclic dependency on Vector3
}(),
this._x = vFrom.y * vTo.z - vFrom.z * vTo.y;
this._y = vFrom.z * vTo.x - vFrom.x * vTo.z;
this._z = vFrom.x * vTo.y - vFrom.y * vTo.x;
this._w = r;
}
return this.normalize();
},
angleTo: function ( q ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册