# Create a 3D polygon

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.

• Try Tetrahedron instead of Triangle Commented Jan 1, 2018 at 20:58
• RegionMember does evaluate on these shape when the second argument is numeric. I would say that the behavior of RegionMember on Cuboid[] is rather nonstandard. Commented Jan 2, 2018 at 5:26

A 3-point polygon in $\mathbb{R}^3$ defines a triangle, whose RegionDimension is 2. Mathematica is correct, and it's unclear what "hasn't been filled" means.

However, if you add a 4th point, you can generate a convex hull (one of many ways of defining 3d meshes):

shape = ConvexHullMesh[{{1, 0, 0}, {1, 1, 1}, {0, 0, 1}, {0, 0, 0}},
Boxed -> True, PlotTheme -> "Detailed"]
RegionDimension@shape


• It would be even simpler with Tetrahedron. Apart from that: good explanation. Commented Jan 1, 2018 at 21:07
• This method gives a different behaviour using RegionMember than Cuboid[]. Why might this be? e.g RegionMember[shape, {x, y, z}] RegionMember[Cuboid[], {x, y, z}] . (it works fine for values for x,y &z). Why might that be? This doesn't seem a fit in replacement for Cuboid[] to be able to make custom shapes.
– Tomi
Commented Jan 1, 2018 at 22:53