Dear Math Forum,
I am using PrincipalComponents[] (in Mathematica 6) to perform a rotation operation on some 3D data (effectively to align my data so that the maximum length of my models runs down the x axis,the maximum width down the y axis, and height max on the z axis).
However, i have noticed that mathematica repeatedly reverses the normal (flips inside out) of and/or mirrors my models. I find this very odd, and was wondering if anyone else had encountered this problem? it seems to happen consistently with certain models, but i cannot see what is different in these models to those (few) that work as they should. if this problem is to do with my data,
can anyone think of a way to rotate the models not using
PrincipalComponents[].
below is the code i have been using on STL (3D points and surface polygon data).
Needs["MultivariateStatistics`"];
3Dmodel = Import["3Dmodel.stl"];
Rotated3Dmodel =
Graphics3D[{EdgeForm[],
Polygon[Partition[
PrincipalComponents[Flatten[3Dmodel[[1, 2, 1]], 1]], 3]]},
Boxed -> False];
Export["Rotated3Dmodel.stl", Rotated3Dmodel];
thank you,
William