In Mathematica, one can triangulate a mesh starting from a boundary mesh region. For example:

r = BoundaryMeshRegion[{{0, 0}, {2, 0}, {2, 1}, {1, 1}, {1, 2}, {0, 2}}, Line[{1, 2, 3, 4, 5, 6, 1}]]
m = TriangulateMesh[r, MaxCellMeasure -> 0.1]

gives a mesh m with an L shape.

From m, it is possible to define another mesh as:

m2 = MeshRegion[MeshCoordinates[m], MeshCells[m, 2]]

Based on my understanding for MeshRegion, m2 should be the same as m. Sure enough if we check the mesh primitives, they are the same:

MeshPrimitives[m2] == MeshPrimitives[m]
(* True *)

However, if we compare m and m2 directly, we find that they are not equal:

(* False *)

So why are they not equal?


The region m appears to have an extra option set, causing them to be considered different regions:

m // Options
(* {Method -> {"PropagateMarkers" -> False}} *)

m2 // Options
(* {} *)

If you copy the options of m into m2, the two regions will be the same:

m2 = MeshRegion[MeshCoordinates[m], MeshCells[m, 2], Options[m]];

m == m2
(* True *)

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.