提交 e6f7d2ac 编写于 作者: M Mugen87

avoid unnecessary Math.sqrt operations

上级 91d7c95a
...@@ -341,7 +341,7 @@ THREE.Matrix4.prototype = { ...@@ -341,7 +341,7 @@ THREE.Matrix4.prototype = {
z.subVectors( eye, target ).normalize(); z.subVectors( eye, target ).normalize();
if ( z.length() === 0 ) { if ( z.lengthSq() === 0 ) {
z.z = 1; z.z = 1;
...@@ -349,7 +349,7 @@ THREE.Matrix4.prototype = { ...@@ -349,7 +349,7 @@ THREE.Matrix4.prototype = {
x.crossVectors( up, z ).normalize(); x.crossVectors( up, z ).normalize();
if ( x.length() === 0 ) { if ( x.lengthSq() === 0 ) {
z.x += 0.0001; z.x += 0.0001;
x.crossVectors( up, z ).normalize(); x.crossVectors( up, z ).normalize();
......
...@@ -701,7 +701,7 @@ THREE.Vector3.prototype = { ...@@ -701,7 +701,7 @@ THREE.Vector3.prototype = {
angleTo: function ( v ) { angleTo: function ( v ) {
var theta = this.dot( v ) / ( this.length() * v.length() ); var theta = this.dot( v ) / ( Math.sqrt( this.lengthSq() * v.lengthSq() ) );
// clamp, to handle numerical problems // clamp, to handle numerical problems
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册