# Rigid Rotation of a Point Cloud

If I have a group of points that are aligned along some vector. For example:

points = Table[{i + 10 RandomReal[{-1, 1}],
i + 10 RandomReal[{-1, 1}], i + 10 RandomReal[{-1, 1}]}, {i, 1,
30, 0.5}];
points = Table[points[[i]] - Mean[points], {i, 1, Length[points]}];


How can I take advantage of the built in rotation functions to rotate it so that the long axis of the data is oriented along the vector {0,1,0}?

Using points as given, you can use RotationMatrix,e.g. :

  Animate[Show[
ListPointPlot3D[RotationMatrix[a, {0, 1, 0}].# & /@ points,
PlotStyle -> {Yellow, PointSize[0.02]},
PlotRange -> Table[{-30, 30}, {3}], Background -> Black,
BoxRatios -> 1],
Graphics3D[{Red, Thickness[0.01],
Arrow[{{0, -30, 0}, {0, 30, 0}}]}]], {a, 0, 2 Pi}]


See comment below by @J.M.:

The rotation can be coded more directly using RotationTransform:, i.e.

RotationTransform[a,{0,1,0}]/@points

• More directly, you can do RotationTransform[a, {0, 1, 0}] /@ points. – J. M.'s technical difficulties May 13 '16 at 9:14
• @J.M. thank you I will edit post. :) – ubpdqn May 13 '16 at 9:15