function R=inrange(a, b, r) % inrange(a, b, r) returns 1 if a is within distance r from b R=(a-b).^2<=r^2;