RegionMember with some tolerance?
This (or an appropriately written variant) works:
myRegionMember[a_, b_] := With[{threshold = 10^-6},
If[
RegionDistance[a, b] < threshold,
True,
False
]
]
There's Internal`$EqualTolerance
. See How to make the computer consider two numbers equal up to a certain precision and its reference.
Block[{Internal`$EqualTolerance = 9.},
RegionMember[Line[{{0, 0}, {1, 10.^-7}}], {.5, 0}]
]
(* True *)
It's a relative tolerance, whereas gpap's & kguler's answers give absolute ones. The setting above, which is roughly equivalent to Internal`$EqualTolerance = $MachinePrecision - 7
, says approximate numbers that agree to seven digits (or differ in at most the last nine) are to be considered equal.
Block[{Internal`$EqualTolerance = $MachinePrecision - 7},
{1. + 1.0000001*^-7 == 1, 1. + 1*^-7 == 1}
]
(* {False, True} *)
f1 = RegionDistance[#, #2] < #3]&
f1[Line[{{0, 0}, {1, 10.^-7}}], {.5, 0}, 10^-6]
(* True *)
f2 = Chop[RegionDistance[#, #2] ,#3] == 0&
f2[Line[{{0, 0}, {1, 10.^-7}}], {.5, 0}, 10^-6]
(* True *)