simple translation Question

Started by
4 comments, last by haegarr 18 years, 4 months ago
hi guys i have a simple question coz i 4got math concepts ;) . i have a point A on a circle in 2d and i want to translate it to a point B on the circle and the angle between them is 75 degree how i can do this ?? how to calculate the coordinates of the point B ??? thanks for any help please see an image explaining this on the following website http://tinypic.com/i1yzj9.jpg [Edited by - jad_salloum on November 30, 2005 3:32:47 AM]
Advertisement
Well, if point A lies on the circle, than its position pA could be determined by the center cC of the circle, the radius rC of the circle, and the angle aA under which is appears, like in:
pA := cC + [ rC * cos(aA) , rC * sin(aA) ]^T
(where zero radians mean the +x direction, and pi/2 radians the +y direction).

You could also determine the angle aA from this formula if the position pA and the circle are given.

Similarly the pB is defined, but with an angle aB that is 75 degrees away:
pB := cC + [ rC * cos(aB) , rC * sin(aB) ]^T
where
aB := aA +/- radians(75 degrees)
(from your linked picture I would use the minus sign).

thanks haegarr for ur reply but what do u mean by " ^T " ?????
Quote:Original post by jad_salloum
thanks haegarr for ur reply but what do u mean by " ^T " ?????
haegarr can correct me if I'm wrong, but I think the ^T is just to indicate a column vector, and in this particular case can be ignored, more or less.

Also, it seems what you're wanting to do is actually a rotation rather than a translation. That is, you want to rotate the vector from the circle center to A by 75 degrees. Pseudocode:
B = A-C;angle = degToRad(angle);B.Set(cos(angle)*B.x-sin(angle)*B.y,sin(angle)*B.x+cos(angle)*B.y);B += C;

Quote:Original post by jyk
Quote:Original post by jad_salloum
thanks haegarr for ur reply but what do u mean by " ^T " ?????
haegarr can correct me if I'm wrong, but I think the ^T is just to indicate a column vector, and in this particular case can be ignored, more or less.

No need to correct, jyk is right. The T stands for "transpose". Especially here I've written them to make clear that the [] terms denote vectors. From the programmer's point of view they can be ignored here.
Only to show (jad_salloum) the interrelation:

In fact the solution I've posted is also a rotation. Jyk's solution rotates an arbitrary point by "angle". My solution rotates a special point, namely
pR := [1,0]^T
by "angle" plus the angle of pA. If you put in pR and the sum of angles into jyk's formula, you'll see the identity.

This topic is closed to new replies.

Advertisement