Bug introduced in 12.2.0 or earlier. Fixed in 13.0.0 or earlier.

There appears to be an issue with RegionMember in Mathematica 12.2 when it comes to simple polygons and points.


enter image description here

However, this:

RegionMember[poly, pts]

results in {False,False} even though, this:

RegionMember[poly,{{1300,1300},{1350,1350}}] works fine.


2 Answers 2

RegionMember[DiscretizeRegion[poly], pts]
RegionMember[BoundaryDiscretizeRegion@poly, pts]

{True, True}

RegionMember[poly // Rationalize, pts]

{True, True}

  • 2
    $\begingroup$ So what's the big picture takeaway here? Just don't ever use RegionMember with actual regions, instead always discretize your regions first? How could anyone ever know to do this? Is there a reason the function is called RegionMember when it's generally incapable of determining actual region membership? $\endgroup$
    – Nickolas
    Commented Mar 10, 2021 at 8:27
  • $\begingroup$ Rationalize is another way. $\endgroup$
    – cvgmt
    Commented Mar 10, 2021 at 8:46
  • 1
    $\begingroup$ Version 12.1 RegionMember gives True. Seems to be a bug that has been fixed in 12.1 $\endgroup$ Commented Mar 10, 2021 at 10:12
  • $\begingroup$ Thank you, @cvgmt for the work-arounds, but I am with Nickolas - there appears to be a bug if this function does not recognize a simple polygon as a correct region. Daniel Huber: I am using 12.2, so if it works in 12.1, the issue must have (re)appeared recently? $\endgroup$
    – drk
    Commented Mar 11, 2021 at 3:16
  • $\begingroup$ An update: @cvgmt Rationalize does NOT always work - I found other examples. DiscretizeRegion worked (at least on my data). $\endgroup$
    – drk
    Commented Mar 11, 2021 at 14:56

The issue appears to have been fixed in V13.0.0


  • 1
    $\begingroup$ Yes, I confirm that RegionMember is now working for the example I had originally provided. $\endgroup$
    – drk
    Commented May 16, 2022 at 23:04
  • $\begingroup$ @drk many thanks for letting me know :) $\endgroup$
    – bmf
    Commented May 17, 2022 at 0:24

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.