Przeglądaj źródła

Quaternion: Simplify .angleTo()

Mugen87 7 lat temu
rodzic
commit
f2c9797bb5
1 zmienionych plików z 3 dodań i 13 usunięć
  1. 3 13
      src/math/Quaternion.js

+ 3 - 13
src/math/Quaternion.js

@@ -393,21 +393,11 @@ Object.assign( Quaternion.prototype, {
 
 	}(),
 
-	angleTo: function () {
+	angleTo: function ( q ) {
 
-		var p = new Quaternion();
+		return 2 * Math.acos( Math.abs( this.dot( q ) ) );
 
-		return function angleTo( q ) {
-
-			p.copy( this ).inverse();
-
-			p.premultiply( q );
-
-			return 2 * Math.acos( p.w );
-
-		};
-
-	}(),
+	},
 
 	inverse: function () {