I am trying to rotate a series of lines by the same angle around their centre point. Say each line is defined by a co-ordinate at each end, simplified example below of a typical dataset.
foo = {{{100, 25}, {150, 45}}, {{200, 45}, {240, 85}}};
Then the midpoint can be found by:-
boo = (#[[2]] - #[[1]])/2 + #[[1]] & /@ foo;
This is visualised using the code below:
Show[
Graphics[{Thick, Dashed, Black, Line /@ foo}],
Graphics[{Black, PointSize[Large],
Point[boo],
Table[{Black, Text[ToString[boo[[p]]], boo[[p]] + 2]}, {p, Length[boo]}]}]
]
I was hoping to create a series of transformations using RotationTransform such as below:
rot = RotationTransform[Pi/2, #] & /@ boo
Then mapping this across foo using MapThread, but I'm not sure which function I should be mapping across to make each line rotate by 90 degrees around its own centre point.
MapThread[?, {woo, rot}]
I think I'm close to what I want to achieve (or maybe not), but I can't quite seem to close it out. All suggestions welcome.
Midpoint
, introduced in 2019, can be used to find the midpoint. It works with a pair of points as well as a line. $\endgroup$