The only solution to this is along the lines of:
for each point
for each line
is distance to line within constraints
The inner loop can be terminated early once a point that lies within the constraint is found. Note that the inner and outer loops can be transposed.
The question then becomes one of determining if a point is within the constraint. mbeckish suggests using a simple rectangle test, where the rectangle is formed by extruding along the line's perpendicular, but this will fail for points near the end points but outside this rectangle. Extruding the rectangle along the direction of the line as well will also fail since the points near the end should really use a point in circle test:
|-------------
| * /
| --
| /
| /
| |
| |
|/
| |--------| <- the line segment
where the * is inside the expanded rectangle but outside the rounded end cap which would be a more strict test.
Now, the distance test might not be a 'as the crow flies' test but a graph search, for example, points within x miles of a road using only roads to connect them together:
--------------------------------------------------- < the road
|
| * <- target
...|..............|................................ < check distance
| |
|--------------| <- roads to target
In the above diagram, the target is within the search area but to get to the target along the available roads would be greater than the allowed distance.
However you choose to implement the test, the basic loop in a loop algorithm will be required.
Ways to check the constraint where the constraint is an 'as the crow flies' constraint:
Geometrically: First, determine the distance from the point P to the line. Then, if the point is within the constraint project the point P onto the line segment, where the line is defined as:
L = P1 + (P2-P1).n
where P1 and P2 are the end points and n is the parametric variable. If the value of n for the projected P is in the range 0 <= n <= 1 then the point is between P1 and P2. Finally, do a point in circle test for circles centred on P1 and P2.
Transformations: Create a transformation matrix for each line segment such that P1 is transformed to the origin and P2 is transformed to (|P1-P2|, 0). Then apply each transform to all points and then test each point in the rectangle (0, -constraint) - (|P1-P2|, constraint). This method can be highly optimised using SIMD or a GPU
Graphically: Draw the line segments to a bitmap using a pen with rounded end caps and a width proportional to the constraint distance. Then, for each test point, check the pixel in the bitmap corresponding to the point. This is not accurate (but bigger bitmaps create more accurate results but need more memory) but is pretty quick once the bitmap is created.
If the constraint is defined by the route along a graph it becomes more complex. You need to look at breadth first searches where the start points are the end of each line segment and the end point is the potential target. If a line segment has junctions along its length, then break the line segment into segments without junctions.