Browse Source

Quaternion: Renamed transformTo() to rotateTowards()

Mugen87 7 years ago
parent
commit
6b81814dfe

+ 2 - 2
docs/api/math/Quaternion.html

@@ -169,12 +169,12 @@
 		<h3>[method:Quaternion premultiply]( [param:Quaternion q] )</h3>
 		<h3>[method:Quaternion premultiply]( [param:Quaternion q] )</h3>
 		<p>Pre-multiplies this quaternion by [page:Quaternion q].</p>
 		<p>Pre-multiplies this quaternion by [page:Quaternion q].</p>
 
 
-		<h3>[method:Quaternion transformTo]( [param:Quaternion q], [param:Float step] )</h3>
+		<h3>[method:Quaternion rotateTowards]( [param:Quaternion q], [param:Float step] )</h3>
 		<p>
 		<p>
 			[page:Quaternion q] - The target quaternion.<br />
 			[page:Quaternion q] - The target quaternion.<br />
 			[page:float step] - The angular step in radians.<br /><br />
 			[page:float step] - The angular step in radians.<br /><br />
 
 
-			Transforms this quaternion by a given angular step to the defined quaternion *q*.
+			Rotates this quaternion by a given angular step to the defined quaternion *q*.
 			The method ensures that the final quaternion will not overshoot *q*.
 			The method ensures that the final quaternion will not overshoot *q*.
 		</p>
 		</p>
 
 

+ 2 - 2
examples/webgl_math_orientation_transform.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js transform orientation</title>
+		<title>three.js webgl - math - orientation transform</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>
@@ -123,7 +123,7 @@
 			if ( ! mesh.quaternion.equals( targetRotation ) ) {
 			if ( ! mesh.quaternion.equals( targetRotation ) ) {
 
 
 				var step = speed * delta;
 				var step = speed * delta;
-				mesh.quaternion.transformTo( targetRotation, step );
+				mesh.quaternion.rotateTowards( targetRotation, step );
 
 
 			}
 			}
 
 

+ 1 - 1
src/math/Quaternion.js

@@ -400,7 +400,7 @@ Object.assign( Quaternion.prototype, {
 
 
 	},
 	},
 
 
-	transformTo: function ( q, step ) {
+	rotateTowards: function ( q, step ) {
 
 
 		var angle = this.angleTo( q );
 		var angle = this.angleTo( q );
 
 

+ 4 - 4
test/unit/src/math/Quaternion.tests.js

@@ -403,7 +403,7 @@ export default QUnit.module( 'Maths', () => {
 
 
 		} );
 		} );
 
 
-		QUnit.test( "transformTo", ( assert ) => {
+		QUnit.test( "rotateTowards", ( assert ) => {
 
 
 			var a = new Quaternion();
 			var a = new Quaternion();
 			var b = new Quaternion().setFromEuler( new Euler( 0, Math.PI, 0 ) );
 			var b = new Quaternion().setFromEuler( new Euler( 0, Math.PI, 0 ) );
@@ -411,14 +411,14 @@ export default QUnit.module( 'Maths', () => {
 
 
 			var halfPI = Math.PI * 0.5;
 			var halfPI = Math.PI * 0.5;
 
 
-			a.transformTo( b, 0 );
+			a.rotateTowards( b, 0 );
 			assert.ok( a.equals( a ) === true, "Passed!" );
 			assert.ok( a.equals( a ) === true, "Passed!" );
 
 
-			a.transformTo( b, Math.PI * 2 ); // test overshoot
+			a.rotateTowards( b, Math.PI * 2 ); // test overshoot
 			assert.ok( a.equals( b ) === true, "Passed!" );
 			assert.ok( a.equals( b ) === true, "Passed!" );
 
 
 			a.set( 0, 0, 0, 1 );
 			a.set( 0, 0, 0, 1 );
-			a.transformTo( b, halfPI );
+			a.rotateTowards( b, halfPI );
 			assert.ok( a.angleTo( c ) - halfPI <= eps, "Passed!" );
 			assert.ok( a.angleTo( c ) - halfPI <= eps, "Passed!" );
 
 
 		} );
 		} );