2
$\begingroup$

I would like to know if it is possible to find the equation of the internal region of a polygon, whose size has been rescaled.

For example:

The analytic region for a Dodecahedron is founded of:

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

if I plot the equation of dodecahedron:

With [{r = 5}, RegionPlot3D [PolyhedronData ["Dodecahedron", "RegionFunction"] [x, y, z], {x, -r,r}, {y, -r, r}, {z, -r, r}, Boxed -> False, Axes -> False, PlotPoints -> 20, Mesh -> None]]

I would like to be able to modify the size of the Dodecahedron, so that it can be contained in a box of size 1 or 2. Something similar to ScalingTransform [{1, 1, 1}], but to applied to an analytic expression.

$\endgroup$
2
  • $\begingroup$ As I commented in your other (deleted) question, the scaling factor you need is PolyhedronData["Dodecahedron", "Circumradius"]. Divide the variables with this factor, and you get the polyhedron inscribed in a sphere of radius $1$. $\endgroup$ Commented Apr 18, 2020 at 11:52
  • $\begingroup$ but does not work, With[{r = 1}, RegionPlot3D[ Apply[PolyhedronData["Dodecahedron", "RegionFunction"], {x, y, z}/ PolyhedronData["Dodecahedron", "Circumradius"]], {x, -r, r}, {y, -r, r}, {z, -r, r}, PlotPoints -> 10]]. The size of the resulting Dodecahedron is greater than 1 $\endgroup$
    – F.Mark
    Commented Apr 18, 2020 at 12:01

1 Answer 1

1
$\begingroup$

Update: Working with the function PolyhedronData["Dodecahedron", "RegionFunction"] and using ScalingTransform:

 regFunc = PolyhedronData["Dodecahedron", "RegionFunction"]

To scale the graphics object with ScalingTransform[{s1,s2,s3}] we can scale the {x,y,z} coordinates passed to regFunc with {1/s1, 1/s2, 1/s3} (that is, use regFunc[x/s1, y/s2, z/s3])

rp3Da = RegionPlot3D[regFunc[x, y, z], 
   {x, -1.5, 1.5}, {y, -1.5, 1.5}, {z, -1.5, 1.5}, 
   PlotStyle -> FaceForm[Opacity[.2, Blue], Opacity[.2, Blue]], 
   Boxed -> False, Axes -> True, PlotPoints -> 50, Mesh -> None, 
   Lighting -> "Neutral"];

rp3Db = RegionPlot3D[regFunc[2 x, 2 y, 2 z]], 
   {x, -1.5, 1.5}, {y, -1.5, 1.5}, {z, -1.5, 1.5}, 
   PlotStyle -> Red, Boxed -> False, Axes -> True, PlotPoints -> 50,
   Mesh -> None, Lighting -> "Neutral"];

Show[rp3Da, rp3Db]

enter image description here

Compare the rp3Db with the result of using ScalingTransform[{1/2, 1/2, 1/2}] on rp3Da:

rp3Dc = MapAt[GeometricTransformation[#, ScalingTransform[{1/2, 1/2, 1/2}]] &, 
   rp3Da, {1}];

Row[Show[#, ImageSize -> Medium] & /@ {rp3Db, rp3Dc}]

enter image description here

Original answer:

ir = PolyhedronData["Dodecahedron", "ImplicitRegion"];

rgnbnds = RegionBounds[N @ ir]
{{-1.37638, 1.37638}, {-1.30902, 1.30902}, {-1.11352, 1.11352}}

You can use RegionMember to get the region function:

rF = RegionMember[ir];

This is same as the function obtained using PolyhedronData["Dodecahedron", "RegionFunction"]:

Resolve @ ForAll[{x, y, z}, Element[{x, y, z}, Reals], 
  Equivalent[rF[{x, y, z}], PolyhedronData["Dodecahedron", "RegionFunction"][x, y, z]]]
 True
rp3d = RegionPlot3D[ir, Boxed -> False, Axes -> True, 
  PlotPoints -> 50, Mesh -> None]

enter image description here

GeometricTransformation + RescalingTransform

1. rescale to unit cube:

MapAt[GeometricTransformation[#, RescalingTransform[rgnbnds]] &, rp3d, {1}]

enter image description here

2. rescale to Cuboid[{-.5, -.5, -.5}, {.5, .5, .5}]:

MapAt[GeometricTransformation[#, RescalingTransform[rgnbnds, {#, #, #}&@{-.5, .5}]] &,
    rp3d, {1}]

enter image description here

ScalingTransform:

MapAt[GeometricTransformation[#, ScalingTransform[{.5, .5, 1}]] &, rp3d, {1}]

enter image description here

TransformedRegion

Alternatively, we can use TransformedRegion with a tranformation of our choice to transformed the region object. For example,

tr = TransformedRegion[ir, ScalingTransform[{.5, .5, 1}]];

RegionPlot3D[tr, Boxed -> False, Axes -> True, PlotPoints -> 50, 
 Mesh -> None]

enter image description here

RegionResize

Resize ir to have "resize the region reg to have the first side length 1 preserving side length ratios":

resized = RegionResize[N @ ir, 1];

RegionPlot3D[resized, Boxed -> False, Axes -> True, PlotPoints -> 50, 
 Mesh -> None]

enter image description here

You can get a region function for the transformed or resized region using RegionMember. For example,

RegionMember[resized][{x, y, z}]
 (x | y | z) ∈ \[DoubleStruckCapitalR] && -46.8328 x - 
   23.4164 z <= 21.1803 && 46.8328 x + 23.4164 z <= 21.1803 && 
 14.4721 x - 44.5407 y + 23.4164 z <= 21.1803 && 10.4721 z <= 4.23607 && 
 14.4721 x + 44.5407 y + 23.4164 z <= 21.1803 && 
 37.8885 x + 27.5276 y - 23.4164 z <= 21.1803 && 
 37.8885 x - 27.5276 y - 23.4164 z <= 21.1803 && 
 -14.4721 x + 44.5407 y - 23.4164 z <= 21.1803 && 
 -2.75276 z <= 1.11352 && -14.4721 x - 44.5407 y - 23.4164 z <= 21.1803 &&
 -37.8885 x - 27.5276 y + 23.4164 z <=  21.1803 &&
  -37.8885 x + 27.5276 y + 23.4164 z <= 21.1803
$\endgroup$
9
  • $\begingroup$ Thank, but I would like to obtain the analytic expression of inner region of a re-scale polygon, similar to PolyhedronData ["Dodecahedron", "RegionFunction"] [x, y, z] $\endgroup$
    – F.Mark
    Commented Apr 18, 2020 at 16:24
  • $\begingroup$ @F.Mark, I added some notes on how you can use RegionMember to get the desired region functions. $\endgroup$
    – kglr
    Commented Apr 18, 2020 at 19:56
  • $\begingroup$ Thanks so much!!! $\endgroup$
    – F.Mark
    Commented Apr 18, 2020 at 21:49
  • $\begingroup$ @F.Mark, you are most welcome. Thank you for the accept. $\endgroup$
    – kglr
    Commented Apr 18, 2020 at 22:21
  • $\begingroup$ Thank you for everything, do you also know if that figure can be rotated around an axis? $\endgroup$
    – F.Mark
    Commented Apr 19, 2020 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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