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一个向量绕零一个向量旋转一个角度后的向量计算
var v_3 = new THREE.Vector3(1,0,0); var v_4 = new THREE.Vector3(0,0,1); var v_34 = v_3.applyAxisAngle(v_4,45.0 * Math.PI / 180.0); console.log(v_34); console.log(Math.round((v_34.x + Number.EPSILON) * 100) / 100);
{ "x": 0.7071067811865475, "y": 0.7071067811865476, "z": 0 }
######################
QQ 3087438119