球体上的寻找点 [英] Finding point on sphere

查看:94
本文介绍了球体上的寻找点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我需要使用半径,圆心和旋转矢量在球体表面上找到该点.我现在有这个等式:

So I need to find the point on a sphere's surface using the radius, the center of the circle and the rotation vector. I have this equation right now:

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)

此公式产生的疯狂结果完全不是我所需要的.老实说,我不知道自己做错了什么,我尝试使用在这里找到的公式: 球形物的发现点

This formula produces crazy results that are totally not what I need at all. I quite honestly have no idea what I've done wrong, I tried to use the formula I found here: Finding Point on sphere

但是没有用.我做错了什么?

But it didn't work. What have I done wrong?

推荐答案

在第三行中,您应具有余弦值:

In your third line, you should have the cosine:

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

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

also, if rotation.x and rotation.y are given in degrees, you might need to multiply the values by pi/180 before giving them as arguments to sin and cos.

这篇关于球体上的寻找点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆