Re: Problem using PrincipalComponents to rotate 3D model data

*To*: mathgroup at smc.vnet.net*Subject*: [mg80875] Re: Problem using PrincipalComponents to rotate 3D model data*From*: Antti Penttilä@smc.vnet.net*Date*: Tue, 4 Sep 2007 06:38:45 -0400 (EDT)*Organization*: University of Helsinki*References*: <fbj2t7$nk0$1@smc.vnet.net>

Will, Principal components, or the principal vectors can be reversed (mirrored) and still be valid principal vectors. If (j,k,l) are the principal vectors, then (-j,-k,-l) or any other combination is also possible. Antti will wrote: > 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 >