I am doing some programming, and I hit a bump. I got a square that I can rotate at will. I got an angle from $0$ to $360$ The square is a fixed size, let's say 3.
Now I need to find the position of the 4 corners. This is "relatively" easy to do when the square is at a fixed angle, as I just need to plus on the $X$ & $Y$ axis, half the width & half the height, to get to a corner. The difficult part for me is to do the same thing while the square is rotated.
Say at $45$degrees I can't figure out the position of the "top left corner" anymore. Is there a simple equation I could use/create that would use say -1.5, 1.5 (on either or both XY axis) that would give me the position $(XY)$ of one of the corners?
Thanks in advance Concerned mathdoer
(Note: I am using this in a script, to spawn objects in a square with a fixed rotation and size, from 1 to 9, from top left to bottom right in orderly fashion)