We can look at the dimension of a shape using RegionDimension
, for example
RegionDimension /@ {Cuboid[], Cone[], Ball[]}
returns {3,3,3}
. This is a 3D shape, i.e. it contains a volume (rather than say Sphere[]
). This is very helpful when using RegionMember[]
.
But, now I want to create my very own shape. But all my Polygons
have a RegionDimension
of 2. , e.g.
shape = Polygon[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}}];
RegionDimension[shape]
Gives a result of 2
. How can I create a custom 3D polygon that acts in the same way as Cuboid[]
- can I make a combination of Cuboids[]
& Cones[]
in one shape?
Edit to clarify question further I wish to be able to create custom shapes in Mathematica that have the same properties as Cuboid[]
. What I am hoping for is RegionMember
to give the general expression for the requirement to be within the shape. E.g
shape0 = Cuboid[];
shape1 = ConvexHullMesh[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}, {0, 0, 0}}];
shape2 = DelaunayMesh[RandomReal[1, {50, 3}]];
shape3 = MeshRegion[{{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}}, {Tetrahedron[{1, 2, 3, 5}], Tetrahedron[{1, 3, 4, 5}]}];
shape4 = BoundingRegion[{{7, 6, 2}, {7, 10, 2}, {9, 2, 6}, {2, 9, 3}, {5, 4, 5}}, "MinConvexPolyhedron"];
shape5 = BoundaryDiscretizeGraphics[Prism[{{1, 0, 1}, {0, 0, 0}, {2, 0, 0}, {1, 2, 1}, {0, 2, 0}, {2, 2, 0}}]];
RegionMember[#, {x, y, z}] & /@ {shape0, shape1, shape2, shape3,
shape4, shape5}
Note how shape0
gives an expression, whereas the others remain in the shape form.
Tetrahedron
instead ofTriangle
$\endgroup$RegionMember
does evaluate on these shape when the second argument is numeric. I would say that the behavior ofRegionMember
onCuboid[]
is rather nonstandard. $\endgroup$