# 立体の主軸

 In[2]:= XarrayMoments[data_List, 0] := Total[data] arrayMoments[data_List, n_Integer?Positive] := (Range[0.5, Length[data] - 0.5]^n.data); arrayMoments[data_List, {ns__Integer?NonNegative}] := Fold[arrayMoments, data, {ns}]/Total[data, \[Infinity]];

データを，指標がグラフィックス座標と並ぶデータ配列に変換する．

 In[3]:= Xdata = ImageData[ ImageReflect[ImageReflect[tooth, Top -> Bottom], Front -> Back]];

 In[4]:= X\[Mu]s = Map[arrayMoments[data, #] &, Reverse@IdentityMatrix[3]];
 In[5]:= X{xx, yy, zz, xy, xz, yz} = Map[arrayMoments[data, Reverse@#] - Times @@ (\[Mu]s^#) &, {{2, 0, 0}, {0, 2, 0}, {0, 0, 2}, {1, 1, 0}, {1, 0, 1}, {0, 1, 1}}];

 In[6]:= X{vals, vecs} = Eigensystem[\!\(TraditionalForm\`\((\*GridBox[{ {xx, xy, xz}, {xy, yy, yz}, {xz, yz, zz} }, GridBoxAlignment->{ "Columns" -> {{Center}}, "ColumnsIndexed" -> {}, "Rows" -> {{Baseline}}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}, GridBoxSpacings->{"Columns" -> { Offset[0.27999999999999997`], { Offset[0.7]}, Offset[0.27999999999999997`]}, "ColumnsIndexed" -> {}, "Rows" -> { Offset[0.2], { Offset[0.4]}, Offset[0.2]}, "RowsIndexed" -> {}, "Items" -> {}, "ItemsIndexed" -> {}}])\)\)]
 Out[6]=

 Out[7]=

## Mathematica

Questions? Comments? Contact a Wolfram expert »