5
$\begingroup$

Consider the intersection of two ConvexHullMesh's, m1 and m2.

m1 = ConvexHullMesh@RandomReal[{0, 1}, {10, 3}];
m2 = ConvexHullMesh@RandomReal[{0, 1}, {10, 3}];
intersection = RegionIntersection[m1, m2];

All have a non-zero Volume

Volume /@ {m1, m2, intersection}

And one can obtain RandomPoints on m1 and m2

RandomPoint@m1  (*works*)
RandomPoint@m2 (*works*)

in contrast,

RandomPoint@intersection (*returns CompiledFunction errors*)

CompiledFunction: Argument Region <code>Mesh</code>CrossingCount errors

All run on 11.3.0 for Mac OS X x86 (64-bit)

Update 1: The 2D version of the above works fine without errors.

Update 2: (23 May 2019) Wolfram Tech Support confirms that this is a bug and is investigating.

$\endgroup$
2
  • 1
    $\begingroup$ Thanks for informing support about this! $\endgroup$ Commented May 23, 2019 at 19:59
  • $\begingroup$ RandomPoint[TriangulateMesh[intersection]] seems to work around the issue. $\endgroup$
    – Greg Hurst
    Commented May 23, 2019 at 20:18

1 Answer 1

2
$\begingroup$

I can reproduce the error, but I don't know what went wrong. This is probably worth a bug report at Wolfram Support.

I found out that BoundaryDiscretizeRegion can help to circumvent the problems.

M = BoundaryDiscretizeRegion@intersection;
RandomPoint@M
$\endgroup$
1
  • 1
    $\begingroup$ Your BoundaryDiscretizeRegion workaround does the job in v11.3.0 $\endgroup$ Commented May 22, 2019 at 18:38

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.