MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Problem using PrincipalComponents to rotate 3D model data

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80849] Problem using PrincipalComponents to rotate 3D model data
  • From: will <willpowers69 at hotmail.com>
  • Date: Tue, 4 Sep 2007 03:43:46 -0400 (EDT)

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


  • Prev by Date: Re: Limits of Nested Expressions
  • Next by Date: Re: ===$MaxMachineNumber}
  • Previous by thread: Re: Insert a Mathematica-Notebook
  • Next by thread: Re: Problem using PrincipalComponents to rotate 3D model data