在球体边缘绘制一个点

在球体边缘绘制一个点

本文介绍了在球体边缘绘制一个点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,从 Flash 背景出发,我对一些简单的 2D 触发有了很好的理解.在带有 I 圆的 2d 中,我知道使用给定角度和半径将项目放置在边缘上的数学方法.

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 radius using.

x = cos(a) * r;
y = sin(a) * r;

现在,如果我在 3d 空间中有一个点,我知道我的球体的半径,我知道我想围绕 z 轴定位它的角度以及我想围绕 y 轴定位它的角度.在我的 3d 空间中找到 x、y 和 z 坐标的数学是什么(假设我的原点是 0,0,0)?我想我可以从圆三角中借用数学,但我似乎找不到解决方案.

Now if i have a point in 3d space, i know the radius of my sphere, i know the angle i want to position it around the z axis and the angle i want to position it around, say, the y axis. What is the math to find the x, y and z coordinates in my 3d space (assume that my origin is 0,0,0)? I would think i could borrow the Math from the circle trig but i can't seem to find a solution.

推荐答案

你在 3d 中的位置由两个角度给出(+ 半径,在你的情况下是常数)

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)

这里,s 是绕 z 轴的角度,t高度 角度,从 z 的向下"测量-轴.

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

下图展示了角度所代表的含义,s=theta 在 xy 平面中 0 到 2*PI 范围内,t=phi 范围内0 到 PI.

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.

这篇关于在球体边缘绘制一个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 09:33