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

Implemented @WestLangley Vector3.reflect() from #4340.

上级 a347231b
......@@ -689,13 +689,14 @@ THREE.extend( THREE.Vector3.prototype, {
reflect: function () {
var v1 = new THREE.Vector3();
// reflect incident vector off plane orthogonal to normal
// normal is assumed to have unit length
return function ( vector ) {
var v1 = new THREE.Vector3();
v1.copy( this ).projectOnVector( vector ).multiplyScalar( 2 );
return function ( normal ) {
return this.subVectors( v1, this );
return this.sub( v1.copy( normal ).multiplyScalar( 2 * this.dot( normal ) ) );
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册