# Rotating a a set of points in a square boxed region by $90$ degree increments [closed]

I have a set of two-dimensional points $P$ in a box with dimensions $(d_1,d_2)$. The coordinate for the lower-left-hand corner of the box is $(0,0)$ and the coordinate for the upper-right-hand corner is $(d_1,d_2)$.

Is there a simple command to rotate the set of points some number of integer degrees (divisible by 90) clockwise or counterclockwise within this box?

-

## closed as off-topic by Kuba, Sjoerd C. de Vries, Artes, Michael E2, Mr.Wizard♦Jul 19 '13 at 5:58

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Kuba, Sjoerd C. de Vries, Artes, Michael E2, Mr.Wizard
If this question can be reworded to fit the rules in the help center, please edit the question.

Have a look at RotationTransform –  Jens Jul 18 '13 at 4:21
Dear moderators - sorry for the poor quality question. Please let me know if you'd like any action on my part. –  Intemediocre Jul 20 '13 at 2:27

Use Rotate:

p = Point@Transpose[RandomReal[#, 10] & /@ {3, 2}];
Graphics@p
Graphics@Rotate[p, 90 Degree, {0, 0}]


If you aren't using graphics primitives you can use RotationTransform like Jens mentioned:

p = Transpose[RandomReal[#, 10] & /@ {3, 2}];
RotationTransform[90 Degree]@p

-
Oh, but how do I extract the new set of coordinates for the point post-rotation? –  Intemediocre Jul 18 '13 at 4:48
Then RotationTransform is appropriate as per Jens' comment. –  Michael Hale Jul 18 '13 at 4:54
You do not need to Map the transform function onto the list of points; simple application is sufficient, and much faster. Try: pts = RandomReal[99, {50000, 2}]; rot = RotationTransform[10 Degree, {50, 50}]; then compare rot[pts] // Timing // First to rot /@ pts // Timing // First. The former is ~325X faster here! –  Mr.Wizard Jul 19 '13 at 6:05
Good to know. Updated. –  Michael Hale Jul 19 '13 at 6:26