Polar Coordinates and Vector Question

Started by
3 comments, last by frob 2 years, 4 months ago

After you get a point on a circle based on polar coordinate conversion the point goes back to origin as if the circle were centered there? I'm wondering how to get the actual point. I think a vector from origin to the center of the circle would be the right track, but not sure. I'm trying to find “Add a standard position vector a point.” but not much showing up. If this is the right method, can someone explain a bit of that?

Advertisement

JeremyB said:
I think a vector from origin to the center of the circle would be the right track

Yes.
We could make an example comparing this with using 4x4 matrices in 3D or 3x3 matrices in 2D:
Your polar coordinates are sin and cos of an angle (you could use complex numbers instead polar coordinates, assuming all your circles and vectors are in 2D). So that's an orientation. We could use it to define a point on a circle, or to define the rotation of a sprite, etc.
Your displacement vector gives then the position of this sprite or circle.

We have those same things in a 4x4 transformation matrix, which is composed of 4 vectors.
3 give the orientation (and scale) of the object (x,y, and z axis), and the 4th vector defines displacement from origin, so position.

So you see your proposal is correct and also common practice. We could take your numbers and convert it to a 3x3 matrix:

// orientation from given polar coords:
c = cos(angle)
s = sin(angle)
// position
x = displacementVector.x
y = displacementVector.y

Matrix3x3 = {
s,c,0 // the unit vector from circle origin to the point on the circle we described with polar coords, maybe to describe an 'sideways' direction, followed by 0 because this is a vector
-c,s,0 // the unit vetor perpendicular to the above, maybe to describe an 'up' direction, followed by 0 because this is a vector
x,y,1}; // the position, followed by 1 becasue this is a point

I don't know what you actually do, but you could use matrices for the same thing, which is the most standard way to deal with transformations not only in games.

Hope this somewhat helps, as it's not really clear what you're asking for.

Thanks for the answer. This will give me enough information to do more research.

Agreed about your question not making complete sense. The origin of a circle is the center. Polar coordinates are a method to find a point both at a radius and angle from the origin of an arbitrary circle no matter where the circle is located.

Points on a circle relative to the center can be computed by multiplying the radius with sine and cosine. It's not the method used in graphics as there are more efficient methods for drawing, but mathematically the functions work for a single point. Use the polar coordinates to compute a position on an arbitrary circle since polar coordinates specify both the angle and the radius but not the position of the circle. Add the circle's origin to get the final location in the space.

This topic is closed to new replies.

Advertisement