在球面上寻找点

6

我需要使用半径、圆心和旋转向量来找到球面上的点。目前我有这个方程:

x = position.x + radius * Math.cos(rotation.x) * Math.sin(rotation.y)
y = position.y + radius * Math.sin(rotation.x) * Math.sin(rotation.y)
z = position.z + radius * Math.sin(rotation.y)

这个公式产生的结果完全不是我所需要的,真的不知道哪里出了问题。我试着使用我在这里找到的公式:Finding Point on sphere,但它并没有起作用。我做错了什么?

2
你把度和弧度搞混了。 - High Performance Mark
好的...那我该怎么办?抱歉,我还没有上过三角课程,我对弧度不太了解... - user1650305
1
Radians = Degrees * (2*PI/360) - RBarryYoung
1个回答

8

在您的第三行中,您应该有余弦:

z = position.z + radius * Math.cos(rotation.y)

如果rotation.xrotation.y以度为单位给出,则在将它们作为sincos的参数之前,您可能需要将这些值乘以pi/180


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接