Archived

This topic is now archived and is closed to further replies.

Chris F

Transforming Vertecies Defined in Polar Cords

Recommended Posts

If I have an object whose vertecies are defined in polar co-ordinates how do I apply the normal transformations to them (rotation, translation etc...)? Does anyone know what matrices can be used to achieve this? Or is there another way? Thanks in advance.

Share this post


Link to post
Share on other sites
Usually polar coordinates are converted to rectangular coordinates to be transformed, and then converted back to polar form. For this reason, you should probably convert your models to rectangular coordinates and just leave them as rectangular coordinates, it would be time consuming to keep converting them. Also, unless you are raytracing, most 3d algorithms use cartesion coordinates.

Polar->Cartesian
x = radius * cosine(angle)
y = radius * sine(angle)

Cartesian->Polar
radius = sqrt( x^2 + y^2)
angle = atan(y/x)

http://3d.n3.net/

Share this post


Link to post
Share on other sites
Thanks. I know how to convert back and fourth. I asked for the techniques to transform polar cords because I''m working on a specialised routine. Thanks anyway.

Share this post


Link to post
Share on other sites
I don't know how to, but I can give you a piece of advice:
When you're working with the polar coordinates, always check up with unit circle.

Transformations:

Translation

_____
/ / / Y-C ¦ // ¦
¦ O-X--¦ // You have Theta the angle and d the Distance.
¦ ¦
\ /
\_____/


If you take the formulas to convert and modify them it gives:

d2 = sqrt( (d1 * cosine(Theta1) + dx)^2 * (d1 * sine(Theta1) + dy)^2)

Now there are ways to reduce this formula, but that's
like it... I would do it for ya, but now I'm sleeping
on the keyboard and I don't have my maths notes... Sorry

Theta2 = atan((d1*sine(Theta1)-dy)/(d1*sine(Theta1)-dx)

I know a way to disamble this into only two operations, but
now like I said I'm gonna sleep...



I'm gonna sleep.... now... sleep... I'm .... ... goo... n... now..... rrrrrrrr...z.z.zzzzzzzz



Edited by - Poltras on June 19, 2000 4:02:51 AM

Share this post


Link to post
Share on other sites
well.. lets see. i''m assuming this is in 3d, so your vertex data looks like this:

float lat, long;
float radius;

assuming the vector origin is always at the object''s local center (0,0,0), translation would be simply changing the center of the object. rotating by polar angles (latitude and longitude) is simply a matter of increasing or decreasing the polar angles of the individual vertices. uniform scaling is just multiplying the radius scalars by a constant value.

it gets trickier if you want to rotate using euler angles. it''s 1:30am here right now, and i''m not sure if i want to do the math necessary not knowing whether that''s what you''re looking for. so if you need that as well, let me know and i''ll post the equations.

-goltrpoat



--
Float like a butterfly, bite like a crocodile.

Share this post


Link to post
Share on other sites