# Are there built in functions to perform a geometric transform to rotate a set of points around an arbitrary point?

I have a list of points {{4,5},{6,7},{9,8},...} in two-dimensions. I'd like to rotate these points some number of degrees $\theta$ around an arbitrary anchor point in a two-dimensional plane, and recover the transformed point list. Is there a straightforward way to do this? How about for three-dimensional rotations around an arbitrary point?

• Have you checked the documentation center? is is very very easy to find in documentation and this question shows no research effort :/
– Kuba
Sep 8, 2013 at 15:04
• @Kuba I've looked at Rotate, GeometricTransform, etc. but they all seem to apply to rotating graphical objects as opposed to point sets.
– ZWei
Sep 8, 2013 at 15:08
• If type in "rotation" the second result is RotationTransform. It is always good idea to check related links at the bottom of each documentation page because RotationTranform appears for example in Rotate page.
– Kuba
Sep 8, 2013 at 15:12
• @Kuba Is it necessary for me to manually enter in and multiply each point by the appropriate rotation matrix? Shouldn't there be a function that takes the point set, a rotation anchor, and then some rotation parameter? I can't seem to find it.
– ZWei
Sep 8, 2013 at 15:13
• RotationTransform[angle \[Degree], anchor] /@ set
– Kuba
Sep 8, 2013 at 15:15

I think RotationTransform is what you are looking for.

data = {{4, 5}, {6, 7}, {9, 8}};
r[angle_?NumericQ, pivot:{_?NumericQ, _?NumericQ}] = RotationTransform[angle Degree, pivot];
r[45, {1, 1}] /@ data // N

{{0.292893, 5.94975}, {0.292893, 8.77817}, {1.70711, 11.6066}}


### Update

As Carl Woll points out in his comment below, the transformation function returned by RotationTransform acts if it has the Listable property, so

r[45, {1, 1}] /* N @ data


also works.

• Thanks. For the purposes of my understanding, what is the purpose of angle?NumericQ?
– ZWei
Sep 8, 2013 at 15:15
• @Kuba. Thanks for pointing out the typos. I have corrected them. Sep 8, 2013 at 15:28
• @ZWei angle_?NumericQ is a pattern test which will run the function only if you pass Numeric variable for the first argumen
– Kuba
Sep 8, 2013 at 15:29
• No need for Map, you can just use r[45, {1, 1}][data]. Feb 21, 2018 at 19:11
• @anderstood. It is RightComposition Feb 22, 2018 at 0:28