Rotating body from spherical coordinates

Is it possible to rotate a body that has its vertices defined in spherical coordinates. I'm currently developing collages in VHDL and doing dodecahedron rotation and presentation over VGA.

I applied the equations and required only two calculations of sin / cos and two multiplications for each vertex. I just thought about rotating around the 3rd axis using 3 steps by two angles, but I can not find the correct equations, even if it is possible.

Edit

I think I get it.

Rotation on the 3rd axis, which is in the same direction as the camera, is only a 2D transformation of the camera coordinates as soon as you calculate them. This means that for rotation along 3 axes (normally two axes and one slope) you need to apply the total number of calculations 4 sin / cos and 4 multiplications. If someone came up with something better, could not post the answer.

+3
source share
2 answers

You can rotate around the y axis by changing θ and turning around the z axis, changing φ. However, the rotation around the X axis is a little stiffer.

One simple way would be to convert everything to Catian coordinates, rotate and convert back.

The equations for (x, y, z) (Cartesian spherical) are

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 φ)

, , .

+8

, - , . :

φ '= tan-1 (y'/x ')  = tan-1 (tan φ cos α - cotan θ sin α sec φ)

, , , .

+5

All Articles