5
$\begingroup$

I think there is potentially a bug in RegionMember function, particularly in the RegionMember[reg] form. Can you evaluate the example code below in other versions and add the bug tag with the question. (evaluated in Mathematica 12.3.1 in windows 10).

reg = Rectangle[{0., 0.2}, {13.5, 15.65}];
pt = {-1.6*^-6, 4.3};
RegionMember[reg, pt]
RegionMember[reg][pt]
$\endgroup$
5
  • 1
    $\begingroup$ Confirmed on mac. $\endgroup$
    – SHuisman
    Commented Sep 20, 2021 at 9:16
  • 1
    $\begingroup$ @SHuisman thanks ! reporting it to support. $\endgroup$
    – Ali Hashmi
    Commented Sep 20, 2021 at 9:21
  • 1
    $\begingroup$ I also submitted it, but through a different portal. $\endgroup$
    – SHuisman
    Commented Sep 20, 2021 at 9:23
  • 1
    $\begingroup$ One workaround is SignedRegionDistance[reg][pt] <= 0. $\endgroup$
    – Greg Hurst
    Commented Sep 20, 2021 at 23:16
  • 1
    $\begingroup$ A workaround using distance to test membership is ok for closed regions, as this rectangle example. But can be misleading for boundary points of open regions. E.g., SignedRegionDistance[ImplicitRegion[x < 1, x]][{1}] is 0, but the point 1 isn't a member of that region. $\endgroup$
    – tad
    Commented Sep 22, 2021 at 21:30

1 Answer 1

1
$\begingroup$

There is a workaround:

reg = Rationalize[Rectangle[{0., 0.2}, {13.5, 15.65}]];
pt = Rationalize[{-1.6*^-6, 4.3}];RegionMember[reg, pt]

False

RegionMember[reg][pt]

False

$\endgroup$
1
  • $\begingroup$ It's enough only reg = Rationalize[Rectangle[{0., 0.2}, {13.5, 15.65}]]; $\endgroup$
    – user64494
    Commented Sep 20, 2021 at 11:12

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.