If we try to make a Polygon with nonplanar points, the documentation says

Non-planar polygons are accepted in Graphics3D and are triangulated, but the result is not platform and view independent and may lead to surprising results.

The surprising result, I think, is that the result appears to be a 2D polygon from almost any viewpoint. Here is one such Polygon from two different viewpoints,

pts = {{0, 0, 1}, {0, 1, 0}, {0, -1, 0}, {1, 0, -1}};
Graphics3D@*Polygon /@ {pts, pts}

enter image description here

But it clearly is showing two polygons with three points each, and I wonder how it chooses those points. The system has chosen two such polygons out of the possible four,

Graphics3D@*Polygon /@ Subsets[pts, {3}]

enter image description here

It's possible to see which were chosen by discretizing the region first and then extracting the polygons,

Polygon[pts] // DiscretizeRegion // MeshPrimitives[#, 2] &
(* {Polygon[{{0., 0., 1.}, {0., -1., 0.}, {1., 0., -1.}}], 
 Polygon[{{0., -1., 0.}, {0., 0., 1.}, {0., 1., 0.}}]} *)

What brings this up is the fact that the system often uses non-planar polygons when creating 3D plots, and the subsequent attempts to turn these plots into boundary regions is somewhat hampered by these nonplanar polygons (with the obvious workaround of first discretizing the graphics and then extracting the polygons).

Is there some way of knowing how the polygons are triangulated?

  • $\begingroup$ Are you interested in quadrilaterals only? $\endgroup$ – BlacKow Apr 13 '16 at 18:27
  • $\begingroup$ @BlacKow Not at all. I just noticed that when I extracted polygons from certain 3D plots, many of them had 4 or 5 points which were not quite coplanar. I just wonder why would MMA use such polygons, how does it deal with them? $\endgroup$ – Jason B. Apr 13 '16 at 18:37
  • $\begingroup$ Your Polygon[pts] // DiscretizeRegion // MeshPrimitives[#, 2] & gives tons of polygons even for 5 points. In case of 4 points it's always two triangles? If yes it's probably possible to reverse engineer how they are generated. $\endgroup$ – BlacKow Apr 13 '16 at 18:41
  • $\begingroup$ @BlacKow I actually haven't tested it on too many, but all I've looked at, four points goes to two triangles. I'd be very happy with just understanding that, absolutely $\endgroup$ – Jason B. Apr 13 '16 at 19:04
  • $\begingroup$ I'm not sure why, but this code pts = {{0, 0, 1}, {0, 1, 0}, {0, -1, 0}, {1, 0, -1}}; Graphics3D@*Polygon /@ {pts, pts}; Polygon[pts] // DiscretizeRegion // MeshPrimitives[#, 2] & // Length already gives me 323 triangles. MMA 10.2 on Mac $\endgroup$ – BlacKow Apr 14 '16 at 15:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.