从球坐标旋转体 [英] Rotating body from spherical coordinates

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

问题描述

是否可以旋转顶点定义在球坐标中的物体.目前我正在用 VHDL 做拼贴项目,是关于旋转十二面体和通过 VGA 呈现.

我应用了针孔相机模型方程,只需要两次正弦/余弦计算和两次乘法每个顶点.我只是想在两个角度上使用 3 步绕第三轴旋转,但我无法找出正确的方程,即使这是可能的.

编辑

我想我明白了.

在与相机相同方向的第 3 轴上旋转只是计算相机坐标后的 2D 变换.这意味着与在 3 轴(可以是两轴和一个倾角)上旋转相比,您需要应用总共 4 次正弦/余弦计算和 4 次乘法.如果有人想出了更好的东西,请随时发布答案.

解决方案

改变θ可以绕y轴旋转,改变φ可以绕z轴旋转.不过,绕 x 轴旋转有点困难.

一种简单的方法是将所有内容都转换为 catesian 坐标,执行旋转,然后转换回来.

(x,y,z)(球到笛卡尔)的方程是

<前>x = r sin θ cos φy = r sin θ sin φz = r cos θ

将 (x,y,z) 旋转到新点 (x', y', z') 绕 x 轴旋转角度 α 的方程为

<前>x' = x= r sin θ cos φy' = y cos α - z sin α= (r sin θ sin φ) cos α - (r cos θ) sin αz' = y sin α + z cos α= (r sin θ sin φ) sin α + (r cos θ) cos α

(r, θ, φ)(笛卡尔到球面)的方程是

<前>r' = sqrt(x'2 + y'2 + z'2)=rθ' = cos-1(z'/r')= cos-1(sin θ sin φ sin α + cos θ cos α)φ' = tan-1(y'/x')= tan-1(tan φ cos α - cotan θ sin α sec φ)

我不知道是否有办法进一步减少这种情况,但应该可行.

Is it possible to rotate body which has its vertices defined in spherical coordinates. Currently I am doing collage project in VHDL and is about rotating dodecahedron and presenting over VGA.

I applied pinhole camera model equations and that required just two sin/cos calculation and two multiplication per vertice. I was just thinking about rotating around 3rd axis using 3 steps over two angles but i am unable to figure out proper equations and even if this is possible.

Edit

I think I got it.

Rotating over 3rd axis which is in same direction as camera is just 2D transform of camera coordinates once you you compute them. That mean than for rotating in 3 axes (ok two axis and one inclination) you need to apply total of 4 sin/cos computations and 4 multiplications. If somebody came up whit something better, fell free to post answer.

解决方案

You can rotate around the y-axis by changing θ, and rotate around the z-axis by changing φ. Rotating around the x-axis, though, is a bit tougher.

One simple way would be to convert everything to catesian coordinates, perform the rotation, and convert back.

The equations for (x,y,z) (spherical-to-cartesian) are

x = r sin θ cos φ
y = r sin θ sin φ
z = r cos θ

The equations for rotating (x,y,z) to new points (x', y', z') around the x-axis by an angle α are

x' = x
   = r sin θ cos φ
y' = y cos α - z sin α
   = (r sin θ sin φ) cos α - (r cos θ) sin α
z' = y sin α + z cos α
   = (r sin θ sin φ) sin α + (r cos θ) cos α

The equations for (r, θ, φ) (cartesian-to-spherical) are

r' = sqrt(x'2 + y'2 + z'2)
   = r
θ' = cos-1(z'/r')
   = cos-1(sin θ sin φ sin α + cos θ cos α)
φ' = tan-1(y'/x')
   = tan-1(tan φ cos α - cotan θ sin α sec φ)

I don't know if there is a way to reduce that any further, but it should work.

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

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