提交 9050f13a 编写于 作者: M Mr.doob

Merge branch 'dev' of https://github.com/mrdoob/three.js into dev

...@@ -399,6 +399,10 @@ THREE.Quaternion.prototype = { ...@@ -399,6 +399,10 @@ THREE.Quaternion.prototype = {
slerp: function ( qb, t ) { slerp: function ( qb, t ) {
if ( t === 0 ) return this;
if ( t === 1 ) return this.copy( qb );
var x = this._x, y = this._y, z = this._z, w = this._w; var x = this._x, y = this._y, z = this._z, w = this._w;
// http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/ // http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/slerp/
......
...@@ -209,3 +209,11 @@ test( "equals", function() { ...@@ -209,3 +209,11 @@ test( "equals", function() {
ok( a.equals( b ), "Passed!" ); ok( a.equals( b ), "Passed!" );
ok( b.equals( a ), "Passed!" ); ok( b.equals( a ), "Passed!" );
}); });
test( "slerp", function() {
var a = new THREE.Quaternion( 0.675341, 0.408783, 0.328567, 0.518512 );
var b = new THREE.Quaternion( 0.660279, 0.436474, 0.35119, 0.500187 );
ok( a.slerp( b, 0 ).equals( a ), "Passed!" );
ok( a.slerp( b, 1 ).equals( b ), "Passed!" );
});
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册