threejs两个向量旋转

2022/5/27 23:22:22

本文主要是介绍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两个向量旋转的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程