eq1: (x1 - x2)^2 + (y1 - y2)^2 <= distance^2
For positions (x1, y1) and (x2, y2). It's basically just checking if x2 is within the circle of radius distance centered at x1.
eq2: (x1 - x2)^2 + (y1 - y2)^2 + (z1 - z2)^2 <= distance^2
For positions (x1, y1, z1) and (x2, y2, z2). Same deal, but now it's a sphere.
This extends in to higher dimensions. You just keep adding in squared terms.