以给定的 (s,t) 角在球体上绘制一个点

Plotting a point on the sphere at given (s,t) angles

已经有一个问题并且有一个答案 here,但是它并不像我期望的那样工作。

# Assume my radius is 1 for simplicity

x = cos(s) * sin(t)
y = sin(s) * sin(t)
z = cos(t)

当t=0时,不考虑我的s,

(x,y,z)=(0,0,1)  

# Since sin 0 = 0 on x 
# and y and z is independent of s

我的世界是这样的

但实际上当s增加时,球面上的点会发生变化,不会一直停留在(0,0,1)。例如。如果我的 s=(-45)deg 和 t=0,球体上的点应该是 (0,0.707,0.707) 对吗?

更新:这是我需要的:

(s,t)   |  (x,y,z)
---------------
(0,0)   |  (0,0,1)
(45,0)  |  (.707,0,0.707)
(90,0)  |  (1,0,0)
(180,0) |  (0,0,-1)
(270,0) |  (-1,0,0)
(0,-45) | (0,0.707,0.707)
(0,45)  | (0,-0.707,0.707)

但是我没有从上面的等式中得到这些结果...!我该怎么办?

用你的公式 t=0 意味着你在极点所以半径为零。无论 s 是什么,输出都应该是 (x,y,z)=(0,0,1)。如果您需要标准球坐标,请使用:

x = cos(s) * cos(t)
y = sin(s) * cos(t)
z =          sin(t)

s = <0,360> [deg]
t = <-90,+90> [deg]

对于(s=45deg,t=0deg)它应该return(x,y,z)=(0.707,0.707,0.000)

PS. 我不确定为什么你在 OP[ 中使用混合坐标 y,z 而不是 x,y

[编辑1]

要匹配您的图像参考框架,请尝试使用这些:

x = sin(s) * cos(t)
y =        - sin(t)
z = cos(s) * cos(t)

s = <0,360> [deg]
t = <-90,+90> [deg]