Rotation 
Author Message
 Rotation

What is the calculation for 2D rotation.

What I have is an array of 2d coordinates that make a up polygon and I need
to rotate it.
Generally the polygons I display are comprised of 20-200 vertices. In
display mode
640X480x24bit colour.

What I need is something that will change the values in my array so I can
then re-display them

Any body seen anything that could do this.



Mon, 25 Feb 2002 03:00:00 GMT  
 Rotation


Quote:
>Any body seen anything that could do this.

This is the wrong newsgroup, but IIRC, the FAQ of
comp.graphics.algorithms has something on this.

Regards,
Marco



Mon, 25 Feb 2002 03:00:00 GMT  
 Rotation


Quote:
> What is the calculation for 2D rotation.

> What I have is an array of 2d coordinates that make a up polygon and I need
> to rotate it.
> Generally the polygons I display are comprised of 20-200 vertices. In
> display mode
> 640X480x24bit colour.

> What I need is something that will change the values in my array so I can
> then re-display them

> Any body seen anything that could do this.

If  (xc,yc) are the coordinates of the center of the rotation and the
rotation angle is 'a' the formula is

        co := cos(a) ; si := sin(a);

        x_new-x_c = co*(x-x_c) - si*(y-y_c)
        y_new-x_c = si*(x-x_c) + co*(y-y_c)

This may be rearranged to

        co := cos(a);
        si := sin(a);

        dx := x_c - (co*x_c-si*y_c);
        dy := y_c - (si*x_c+si*y_c);

   for all (x,y) do

       x_new = co*x - si*y + dx;
       y_new = si*x + co*y + dy;

dx and dy are 0 if you rotate about the origin (0,0).

Regards
Horst



Mon, 25 Feb 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. vector rotation unit needed

2. Help: Rotation algorithm

3. circular rotation

4. 2d rotation

5. rotation (pascal)

6. 3D rotation with mouse ?

7. Q: 3D rotation with mouse

8. 3D rotation with mouse

9. 3d rotation with mouse

10. Q: 3D rotation with mouse

11. VERY FAST 2D ROTATION

12. pgm image rotation in C

 

 
Powered by phpBB® Forum Software