为什么在这种情况下 THREE.Vector3.sub 会返回 (0,0,0)?
p0 = new THREE.Vector3( 0, 100, 50 );
p1 = new THREE.Vector3( 0, 50, 100 );
dummy = new THREE.Vector3(0,0,0);
p1_relative_to_p0 = dummy.sub(p1, p0);
console.log(p1_relative_to_p0);
这是 THREE.Vector3 原型的子函数:
sub: function ( a, b ) {
this.x = a.x - b.x;
this.y = a.y - b.y;
this.z = a.z - b.z;
return this;
},
控制台输出:
三.Vector3 x: 0 y: 0 z: 0
为什么不是输出 (0, 50, -50) ?
代码可以在这里看到: https ://dl.dropbox.com/u/2070405/webgl_lines_splines_jon.html