I am trying to NIntegrate a non-planar polygonal region defined by 4 points, something like this:
p1 = {1, 1, 1};
p2 = {-1, 1, 1};
p3 = {-1, -1, 1};
p4 = {1, -1, 4};
region = Polygon[{p1, p2, p3, p4}];
Show[Graphics3D[region]]
NIntegrate[1, {x, y, z} \[Element] region]
And this is the result I get:
What is the correct way of doing this? The integral works when the polygon is planar. I could separate the polygon into two triangles, but since the points vary a lot with each iteration of my script that might be an additional issue.
Polygon
Degenerate polygons are not valid geometric regions: and if you evaluateRegionQ[region]
it isFalse
when region is degenerate. $\endgroup$region = MeshRegion[{p1, p2, p3, p4}, {Triangle[{1, 2, 3}], Triangle[{1, 3, 4}]}];
$\endgroup$