Plotting a point on the edge of a sphere

后端 未结 2 982
名媛妹妹
名媛妹妹 2020-11-30 04:59

So coming from a flash background I have an OK understanding of some simple 2D trig. In 2d with I circle, I know the math to place an item on the edge given an angle and a

2条回答
  •  没有蜡笔的小新
    2020-11-30 05:25

    Your position in 3d is given by two angles (+ radius, which in your case is constant)

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

    here, s is the angle around the z-axis, and t is the height angle, measured 'down' from the z-axis.

    The picture below shows what the angles represent, s=theta in the range 0 to 2*PI in the xy-plane, and t=phi in the range 0 to PI.

提交回复
热议问题