# Computer graphics question

I have a small set of 2d coordinates that I want to rotate 90 degrees and I can’t remember how to do that. IIRC, it is something like (x, y) cross ((cos(theta), 0),(0, sin(theta))), but I can’t remember if that is correct. The stuff I find online is much too complicated for my purposes.

Rob

For starting coordinates x1,y1, and a rotation of 90° CCW,
Isn’t this just x1->y2, y1->-x2?

If you mean x1->y1, y1->-x1, then no, not generally.

Thanks,
Rob

That’s not what I wrote.

For initial coordinates, X1,y1, a rotation without translation of 90°CCW, results in coordinates of x2,y2, such that y2 = x1, and x2 = -y1, unless I am missing something.

In general, to rotate (x,y) to (x’,y’) you could do something like

``````
x' = x*cos(θ) - y*sin(θ)
y' = x*sin(θ) + y*cos(θ)

``````

Is that what you wanted? That’s around the origin, but you could create rotation around some arbitrary point by translating the coordinates appropriately before/after.

Which for 90°, is what I wrote above…