7
$\begingroup$

I'm quite new to Mathematica and have big troubles with understanding regions correctly. Especially when using the function Polyhedron I'm completely stuck. According to the documentation, the function Polyhedron[{f1,...,fn}] "is a volume region, representing all the points inside the closed surface with polygon faces fi".

Now I construct a polyhedron as follows:

{p0, p1, p2, p3} = {{0, 0, 0}, {Sqrt[3]/2, 1/2, 0}, {Sqrt[3]/2, -(1/2), 0}, {0, 0, -3/2}};
polyhedron = Polyhedron[{{p1, p2, p3}, {p1, p2, p0}, {p1, p0, p3}, {p2, p3, p0}}];

I get true for RegionQ@polyhedron as expected, but why does RegionMember[polyhedron,{0.1,0,-0.1}] not even evaluate, althoug the specified point {0.1,0,-0.1} lies within the volume of the defined polyhedron.

$\endgroup$

1 Answer 1

5
$\begingroup$

Here we use BoundaryMeshRegion

{p0, p1, p2,p3} = {{0, 0, 0}, {Sqrt[3]/2, 1/2, 0}, {Sqrt[3]/2, -(1/2), 0}, {0, 0, -3/2}};
polyhedron = 
  Polyhedron[{{p1, p2, p3}, {p1, p2, p0}, {p1, p0, p3}, {p2, p3, p0}}];
newpolyhedron = BoundaryMeshRegion[polyhedron];
RegionMember[newpolyhedron, {0.1, 0, -0.1}]
Graphics3D[{Red, Point[{0.1, 0, -0.1}], Cyan, Opacity[0.1], 
  newpolyhedron}, Boxed -> False]

True

enter image description here

$\endgroup$
5
  • $\begingroup$ Thanks a lot for your solution! However, it does not work for me. The line RegionMember[newpolyhedron, {0.1, 0, -0.1}] gives the error "A correctly specified region expected at position 1 of RegionMember[newpolyhedron, {0.1, 0, -0.1}]". What is the reason, that one first have to use BoundaryMeshRegion? I thought that Polyhedron already defines a volume region that should work together with RegionMember. $\endgroup$
    – Sven
    Nov 23, 2020 at 9:10
  • $\begingroup$ BoundaryMesh also work. $\endgroup$
    – cvgmt
    Nov 23, 2020 at 9:25
  • $\begingroup$ 12.1.1 work well. What is your version? $\endgroup$
    – cvgmt
    Nov 23, 2020 at 10:47
  • $\begingroup$ Clear[polyhedron, newpolyhedron]; {p0, p1, p2, p3} = {{0, 0, 0}, {Sqrt[3]/2, 1/2, 0}, {Sqrt[3]/2, -(1/2), 0}, {0, 0, -3/2}}; polyhedron = Polyhedron[{{p1, p2, p3}, {p1, p2, p0}, {p1, p0, p3}, {p2, p3, p0}}]; newpolyhedron = BoundaryMesh[polyhedron]; RegionMember[newpolyhedron, {0.1, 0, -0.1}] also gives error? $\endgroup$
    – cvgmt
    Nov 23, 2020 at 10:50
  • $\begingroup$ Yes, it gives the same error. I also tried restarting Mathematica, because I thought there was an issue with global variables or something. I have version 12.0.0.0 $\endgroup$
    – Sven
    Nov 23, 2020 at 16:57

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.