A more general question would be: How to find logical expressions for 3D-objects described by closed polygon sets?
Finally a simple question is more prolific, therefore:
How to define logical expressions for platonic solids ?
I study this question for two days now, and I thought, I found an answer already:
PolyhedronData["Tetrahedron", "RegionFunction"]
(* out *)
Sqrt[2] + 4 Sqrt[3] #3 >= 0 &&
4 Sqrt[3] #3 <= 3 Sqrt[2] + 8 Sqrt[6] #1 &&
4 Sqrt[3] (Sqrt[2] #1 + #3) <= 3 Sqrt[2] (1 + 4 #2) &&
4 (Sqrt[6] #1 + 3 Sqrt[2] #2 + Sqrt[3] #3) <= 3 Sqrt[2] &
So far, so good. But then I discovered ...
PolyhedronData["Octahedron", "RegionFunction"]
Missing["NotAvailable"]
ok, this is not dramatic, I can define this myself. But doing so, I found out, it is better to give up those incomplete and specific RegionFunction
definitions of Mathematica. This led me back to my question: How to define region functions for the 5 platonic solids in a better way? What are your ideas, your suggestions?
At the moment I just want to concentrate on the platonics.
c = constant = Abs@1; (* -1 <= c <= +1 *)
plotPoints = 100/2; (* half value while testing *)
RegionPlot3D[
And[x + y + z <= c, -x - y + z <= c,
x - y - z <= c, -x + y - z <= c, -x - y - z <= c, x + y - z <= c,
x - y + z <= c, -x + y + z <= c], {x, -c, c}, {y, -c, c}, {z, -c,
c}, PlotPoints -> plotPoints]
The octahedron region function could be simplified to: (not sure, if it's really a good idea )
RegionPlot3D[
Abs@x + Abs@y + Abs@z <= c, {x, -c, +c}, {y, -c, +c}, {z, -c, +c},
PlotPoints -> plotPoints]
two region functions for tetrahedrons of interest
RegionPlot3D[
And[x + y - z <= c, +x - y + z <= c, -x + y + z <= c, -x - y - z <=
c], {x, -c, +c}, {y, -c, +c}, {z, -c, +c}, PlotPoints -> plotPoints]
RegionPlot3D[
And[x - y - z <= c, -x - y + z <= c, -x + y - z <= c, +x + y + z <=
c], {x, -c, +c}, {y, -c, +c}, {z, -c, +c}, PlotPoints -> plotPoints]
What would be nice
regionFunctions for Dodecahedron
or Icosahedron
, to complete the 5 platonics ?
You may checkout yourself the definitions for RegionFunction
done by Mathematica. Especially non-convex polyhedrons have no region functions defined. (code from Mathematica, modfied):
Manipulate[
Column[{PolyhedronData[g], PolyhedronData[g, p]}], {{g, "Octahedron",
"polyhedron" // Style[#, [email protected], "Menu"] &},
PolyhedronData[All]}, {{p, "RegionFunction" (* init *),
"property" // Style[#, [email protected], "Menu"] &},
Complement @@ PolyhedronData /@ {"Properties", "Classes"}}]
PolyhedronData[]
, including the Platonic solids. $\endgroup$nice
region functions in V10? Can you kindly post me the output ofPolyhedronData["Octahedron","RegionFunction"]
in an answer? $\endgroup$ContourPlot3D[Norm[{x,y,z},1]==1,{x,-1,1},{y,-1,1},{z,-1,1}]
. $\endgroup$