Consider the expression
RandomPoint@
BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}}]}]
This does not evaluate to a random point in the region (in 12.3), and instead stays unevalauted. However, the argument is both RegionQ
and ConstantRegionQ
, as required by the documentation:
RandomPoint
can generate random points for anyRegionQ
region that is alsoConstantRegionQ
.
At first I thought it might be due to the degeneracy of the example, but using
RandomPoint @ BooleanRegion[#1 && ! #2 &, {Sphere[{0, 0, 0}], ConicHullRegion[{{0, 0, 0}}, {{1, 1, 1}, {0, 1, 1}, {1, 0, 1}}]}]
fails as well. (Yet this BooleanRegion
is bona fide: try putting Region
in front.)
It doesn't seem to be a problem with BooleanRegion
, as e.g. RandomPoint @ BooleanRegion[#1 && ! #2 &, {Sphere[], Ball[{1,1,1}]}]
works.
What's happening here, and what's a suitable workaround?
EDIT: Looks like applying DiscretizeRegion
before RandomPoint
works! But why doesn't RandomPoint
evaluate as expected?
RandomPoint
knows how to work with meshes. $\endgroup$