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