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.
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.
My failure to credit your reply was an oversight on my part. Of course, you were correct. I just wanted to provide the more generalized solution in the hope that sweeteviljesus would recognize it as his forgotten transformation.
No problem.
I just hoped I didn’t miss something important…
As an aside, I once wrote code to rotate bitmaps by 90° - there are some interesting tradeoffs between algorithmic complexity, execution speed, and memory usage. Of course, these days you just use an API to do it…