3
$\begingroup$

Is it possible to find the equation of the internal region of a rotated polyhedron? For example, the analytic region for a Dodecahedron is found by:

PolyhedronData["Dodecahedron", "RegionFunction"][x, y, z]

How does one find the equation of the same Dodecahedron rotated some angle about $x$, $y$ or $z$ axis?

$\endgroup$
1
$\begingroup$
ClearAll[regF]
regF = PolyhedronData["Dodecahedron", "RegionFunction"];

regF[x, y, z] // TeXForm

$\scriptsize\sqrt{10 \left(5+\sqrt{5}\right)} (2 x+z)+5 \left(2+\sqrt{5}\right)\geq 0\land \sqrt{10 \left(5+\sqrt{5}\right)} (2 x+z)\leq 5 \left(2+\sqrt{5}\right)\land \sqrt{50-10 \sqrt{5}} x+\sqrt{10 \left(5+\sqrt{5}\right)} z\leq 5 \left(\left(1+\sqrt{5}\right) y+\sqrt{5}+2\right)\land \sqrt{2 \left(5+\sqrt{5}\right)} z\leq 2+\sqrt{5}\land \sqrt{50-10 \sqrt{5}} x+5 \left(1+\sqrt{5}\right) y+\sqrt{10 \left(5+\sqrt{5}\right)} z\leq 5 \left(2+\sqrt{5}\right)\land 2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x+10 y\leq \sqrt{10 \left(5+\sqrt{5}\right)} z+5 \left(2+\sqrt{5}\right)\land 2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x\leq 10 y+\sqrt{10 \left(5+\sqrt{5}\right)} z+5 \left(2+\sqrt{5}\right)\land 5 \left(1+\sqrt{5}\right) y\leq \sqrt{50-10 \sqrt{5}} x+\sqrt{10 \left(5+\sqrt{5}\right)} z+5 \left(2+\sqrt{5}\right)\land z+\sqrt{\frac{5}{8}+\frac{11}{8 \sqrt{5}}}\geq 0\land \sqrt{50-10 \sqrt{5}} x+5 \left(1+\sqrt{5}\right) y+\sqrt{10 \left(5+\sqrt{5}\right)} z+5 \left(2+\sqrt{5}\right)\geq 0\land \sqrt{10 \left(5+\sqrt{5}\right)} z\leq 2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x+5 \left(2 y+\sqrt{5}+2\right)\land 10 y+\sqrt{10 \left(5+\sqrt{5}\right)} z\leq 2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x+5 \left(2+\sqrt{5}\right)$

ClearAll[rotate, rotatedRegF]

rotate[t_, axis : ("xaxis" | "yaxis" | "zaxis") : "xaxis"] := RotationTransform[t, 
  axis /. Thread[{"xaxis", "yaxis", "zaxis"} -> IdentityMatrix[3]]] @* List;

rotatedRegF[rf_, t_, axis : ("xaxis" | "yaxis" | "zaxis") : "xaxis"][x_, y_, z_] := 
   rf @@ rotate[t, axis][x, y, z]

rotatedRegF[regF, t][x, y, z] // TeXForm

$\scriptsize\sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t)+2 x)+5 \left(2+\sqrt{5}\right)\geq 0\land \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t)+2 x)\leq 5 \left(2+\sqrt{5}\right)\land \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+\sqrt{50-10 \sqrt{5}} x\leq 5 \left(\left(1+\sqrt{5}\right) (y \cos (t)-z \sin (t))+\sqrt{5}+2\right)\land \sqrt{2 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))\leq 2+\sqrt{5}\land \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+5 \left(1+\sqrt{5}\right) (y \cos (t)-z \sin (t))+\sqrt{50-10 \sqrt{5}} x\leq 5 \left(2+\sqrt{5}\right)\land 10 (y \cos (t)-z \sin (t))+2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x\leq \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+5 \left(2+\sqrt{5}\right)\land 2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x\leq \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+10 (y \cos (t)-z \sin (t))+5 \left(2+\sqrt{5}\right)\land 5 \left(1+\sqrt{5}\right) (y \cos (t)-z \sin (t))\leq \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+\sqrt{50-10 \sqrt{5}} x+5 \left(2+\sqrt{5}\right)\land y \sin (t)+z \cos (t)+\sqrt{\frac{5}{8}+\frac{11}{8 \sqrt{5}}}\geq 0\land \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+5 \left(1+\sqrt{5}\right) (y \cos (t)-z \sin (t))+\sqrt{50-10 \sqrt{5}} x+5 \left(2+\sqrt{5}\right)\geq 0\land \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))\leq 5 \left(2 (y \cos (t)-z \sin (t))+\sqrt{5}+2\right)+2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x\land \sqrt{10 \left(5+\sqrt{5}\right)} (y \sin (t)+z \cos (t))+10 (y \cos (t)-z \sin (t))\leq 2 \sqrt{5 \left(5+2 \sqrt{5}\right)} x+5 \left(2+\sqrt{5}\right)$

rfunctions = {"regF", "rotatedRegF[regF,Pi/2]",  "rotatedRegF[regF,Pi/2, \"yaxis\"]", 
  "rotatedRegF[regF,Pi/2, \"zaxis\"]"};

Grid[Partition[Labeled[RegionPlot3D[ToExpression[#][x, y, z],
     {x, -2, 2}, {y, -2, 2}, {z, -2, 2}, 
      PlotPoints -> 40, ImageSize -> 300, 
      Method -> {"ShrinkWrap" -> True}, Boxed -> False, 
      AxesOrigin -> {0, 0, 0}], #, Top] & /@ rfunctions, 2], 
 Dividers -> All]

enter image description here

Update: For interactive display, rendering the polyhedron once and using GeometricTransformation with desired transformation is faster:

ir = PolyhedronData["Dodecahedron", "ImplicitRegion"];
rp = RegionPlot3D[ir, PlotPoints -> 70];

{xaxis, yaxis, zaxis} = IdentityMatrix[3];

Panel @ Manipulate[Row[Panel[
      Graphics3D[{{EdgeForm[], FaceForm[], 
         Cuboid[{-3, -3, -3}, {3, 3, 3}], Red, PointSize[Large], 
         Point[ctr]}, EdgeForm[None], FaceForm[Opacity[.5]], 
        GeometricTransformation[rp[[1]], RotationTransform[t, #]]}, 
       Axes -> True, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}, 
       AxesOrigin -> {0, 0, 0}, Boxed -> False, ImageSize -> 300, 
       PlotLabel -> #]] & /@ {xaxis, yaxis, zaxis}], 
   {{t, 0}, -Pi, Pi}, Paneled -> False]

enter image description here

Anchor rotation at, say, vv = {2, 1, 1}:

vv = {2, 1, 1};
centroid = {0.0000305046, -0.0000984894, -0.0000394806};

Manipulate[Row[Panel[
     Graphics3D[{{EdgeForm[], FaceForm[], 
        Cuboid[{-3, -3, -3}, {3, 3, 3}], Red, PointSize[Large], Point[vv]},
       Dashed, Thick, Opacity[1, Blue], 
       GeometricTransformation[Line[{centroid, vv}], RotationTransform[t, #, vv]], 
       EdgeForm[None], FaceForm[Opacity[.5]], 
       GeometricTransformation[rp[[1]], RotationTransform[t, #, vv]]},
      Axes -> True, 
      PlotRange -> {{-6, 6}, {-6, 6}, {-6, 6}}, 
      AxesOrigin -> {0, 0, 0}, Boxed -> False, ImageSize -> 300, 
      PlotLabel -> #]] & /@ {xaxis, yaxis, zaxis}], 
   {{t, 0}, -Pi, Pi},  Paneled -> False]

enter image description here

| improve this answer | |
$\endgroup$
3
$\begingroup$
PolyhedronData["Dodecahedron", "RegionFunction"][x, y, z] /. 
{x -> x Cos[\[Theta]] - y Sin[\[Theta]], 
 y -> y Cos[\[Theta]] + x Sin[\[Theta]]}
| improve this answer | |
$\endgroup$
  • $\begingroup$ ...and if you want to apply a 3D rotation matrix, you could do something like PolyhedronData["Dodecahedron", "RegionFunction"][x, y, z] /. Thread[{x, y, z} -> RollPitchYawMatrix[{π/5, -π/2, π}, {3, 2, 1}].{x, y, z}] $\endgroup$ – J. M.'s discontentment Apr 20 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.