其他分享
首页 > 其他分享> > threejs两个向量旋转

threejs两个向量旋转

作者:互联网

threejs向量旋转

threejs一个向量绕另一个向量旋转

threejs向量变换

 

var v3 = new THREE.Vector3(0,1,1);
var v1 = new THREE.Vector3(1,0,0);
var v2 = new THREE.Vector3(1,1,0);
var v4 = new THREE.Vector3(0,0,1);
var angle1 = v1.angleTo(v2);  //
var angle2 = v2.angleTo(v1);  //

console.log(angle1);
console.log(angle2);


var v32 = v3.cross(v2);
console.log( v1.x + ' ' + v1.y + ' ' + v1.z );
console.log( v2.x + ' ' + v2.y + ' ' + v2.z );
console.log( v3.x + ' ' + v3.y + ' ' + v3.z );
console.log(v32);

var t1 = v1.normalize();
console.log(t1);

var t2 = v1.angleTo(v2);
console.log(t2);

var v12 = v1.cross(v4);
console.log(v12);

 

0.7853981633974484
0.7853981633974484
175 1 0 0
176 1 1 0
177 -1 1 -1
Vector3 {x: -1, y: 1, z: -1}
Vector3 {x: 1, y: 0, z: 0}
0.7853981633974484
Vector3 {x: 0, y: -1, z: 0}

 

 

######################

标签:threejs,console,log,Vector3,旋转,v1,v2,var,向量
来源: https://www.cnblogs.com/herd/p/16319084.html