我在两点之间的球体上画弧时遇到了一些麻烦。我的方法是:
- 在 P1 和 P2 之间用球体半径画一条角弧,从 0 开始
- 绕 X 轴旋转
- 绕 Z 轴旋转
- 绕 Y 轴旋转
我的功能是:
// compute angle between p1 and p2
var angle = Math.acos(p1.dot(p2)/(p1.length()*p2.length()));
// create arc
var geometry = new THREE.CircleGeometry(earthRadius, earthBands, 0, angle);
// remove center vertex
geometry.vertices.splice(0,1);
// rotate around x axis
geometry.applyMatrix(new THREE.Matrix4().makeRotationX(Math.atan((p2.z-p1.z) / (p2.y-p1.y))));
// rotate around z axis
geometry.applyMatrix(new THREE.Matrix4().makeRotationZ(-Math.atan(p1.y / p1.x)));
// rotate around y axis
geometry.applyMatrix(new THREE.Matrix4().makeRotationY(Math.atan(p1.z / p1.y)));
这是在球体上画弧的好方法吗?为什么圆弧没有正确旋转?