2
$\begingroup$

I am trying to fill a rotated convex polyhedron with points. This functions well in the unrotated case:

pts = Flatten[Table[{x, y, z}, {x, -2, 2, 0.1}, {y, -2, 2, 0.1}, {z, -2, 2, 0.1}], 2];
inside = Select[pts,Apply@PolyhedronData["Dodecahedron","RegionFunction"]];
Graphics3D[{Sphere[inside, 0.1]}, Axes -> True, AxesLabel -> {"x", "y", "z"}, Ticks -> {{-2, 2}, {-2, 2}, {-2, 2}}]

Now, I would like to do the same but with a previously rotated polyhedron as it can be displayed with:

Graphics3D[
 GeometricTransformation[{PolyhedronData["Dodecahedron", 
    "GraphicsComplex"]}, RotationMatrix[-36 Degree, {0, 0, 1}]], 
 Axes -> True, AxesLabel -> {"x", "y", "z"}, 
 Ticks -> {{-2, 2}, {-2, 2}, {-2, 2}}]

So far, I have tried using GeometricTransformation and Rotate on PolyhedronData["Cuboctahedron"], which didn't work out.

$\endgroup$
5
$\begingroup$

If you use a BoundaryMeshRegion, you can transform the region, and then create a RegionMemberFunction from it.

mesh = PolyhedronData["Dodecahedron", "BoundaryMeshRegion"];
transform = TransformedRegion[mesh, RotationTransform[-36 Degree, {0, 0, 1}]];
rmf = RegionMember[transform];

Then, use rmf in your Select:

pts = Flatten[Table[{x, y, z}, {x, -2, 2, 0.1}, {y, -2, 2, 0.1}, {z, -2, 2, 0.1}], 2];
inside = Select[pts, rmf];
Graphics3D[{Sphere[inside, 0.1]}, Axes -> True, AxesLabel -> {"x", "y", "z"}, Ticks -> {{-2, 2}, {-2, 2}, {-2, 2}}]

enter image description here

It is also possible to use RandomPoint to get random points in the dodecahedron:

Graphics3D[{Sphere[RandomPoint[transform, 10000],.1]}]

enter image description here

$\endgroup$
1
$\begingroup$

Here's another approach:

reg = Dodecahedron[{-36 Degree, 0}];
RegionImage[reg, Quiet @ RegionBounds[reg]]

$\endgroup$

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.