2
$\begingroup$

I want to take region difference of a sub-mesh of a Delaunay Mesh and a discretized ImplicitRegion. However, Mathematica does not recognize the return as a MeshRegion. Moreover, Discretizing the returned result does not yield a Mesh region. I am attaching a sample code below that illustrates this.

First I define a discretized implicit region.

reg=DiscretizeRegion[ImplicitRegion[-2 < x < 2 && -2 < y < 2, {x,y}]];

Then I take a list of random points in a subregion -2 < x,y < -1.

testReg = RandomReal[{-2, -1}, {10^4, 2}];

I now take a sub-mesh of the delaunaymesh of the above list of points (testReg).

d = .03;
mesh=MeshRegion[testReg,Select[MeshCells[DelaunayMesh[testReg],2],(EuclideanDistance[testReg[[#[[1,1]]]],testReg[[#[[1,2]]]]]<d&&EuclideanDistance[testReg[[#[[1,1]]]],testReg[[#[[1,3]]]]]<d&&EuclideanDistance[testReg[[#[[1,2]]]],testReg[[#[[1,3]]]]]<d)&]];

Now, I have two mesh regions reg and mesh of which I want to take the difference. I define

regDif = RegionDifference[reg, mesh];

This is a region however not a mesh region. RegionQ on regDif returns true. MeshRegionQ does not. Moreover, DiscretizeRegion[regDif] does not return a mesh region either.

Is there any way to resolve this issue?

Edit: I am on version 10.0.0. This issue is absent in version 11.3

$\endgroup$
  • 3
    $\begingroup$ If I recall correctly, this should work with version 11.2 or higher (I tested it with 11.3). $\endgroup$ – Henrik Schumacher Apr 30 '18 at 7:29
  • $\begingroup$ Thank you. I am on version 10.0.0. I think that is the problem. $\endgroup$ – Himalaya Senapati Apr 30 '18 at 8:11
  • 2
    $\begingroup$ @HimalayaSenapati If you wrap your entire call in CloudEvaluate, you'll get a remote kernel on 11.3 to do this for you. $\endgroup$ – Chip Hurst Apr 30 '18 at 14:23
  • $\begingroup$ On v10.4: Head@regDif yields BoundaryMeshRegion; MeshRegionQ@regDif indeed gives False, but MeshRegionQ@DiscretizeRegion@regDif returns True. $\endgroup$ – corey979 Jun 17 '18 at 20:54

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.