# Table with an angle | rotate the co-ordintae

I have the following,

Flatten[MapAt[Reverse, 2]@
Table[{i, j}, {i, 0, 10, 10}, {j, 0, 90, 90}], 1]


that gives,

{{0, 0}, {0, 90}, {10, 90}, {10, 0}}


which are basically a rectangle coordinates, and shape will be

is there anyway I can rotate the coordinates by 45 degree, so the shape will look like the following,

## 1 Answer

You can achieve a rotation by using "GeometricTransformation" together with "RotationTransfrom". For your example we draw a line with the given coordinates:

dat = Flatten[
MapAt[Reverse, 2]@Table[{i, j}, {i, 0, 10, 10}, {j, 0, 90, 90}], 1];
dat = Append[dat, dat[[1]]];
Graphics[{Line[dat]}]


Now we rotate the shape:

rot = RotationTransform[-Pi/4];
Graphics[GeometricTransformation[Line[dat], rot]]


To get the rotated coordinates, write:

rot[dat]

{{0, 0}, {45 Sqrt[2], 45 Sqrt[2]}, {50 Sqrt[2],
40 Sqrt[2]}, {5 Sqrt[2], -5 Sqrt[2]}, {0, 0}}

• Thanks! I need to rotate the co-ordinates rather than the shape (GeometricTransformation).
– a019
May 25 at 12:07
• I added this part. May 25 at 12:13