If the foot of perpendicular from P to the segment is inside the segment, it is the "usual" case. Otherwise, it is the distance from P to the nearest end of the segment.

The locus of points at a given distance d from the segment is made of two segments, parallel to AB at distance d, and of two half circles with radius d.

We study now the locus of points at same distance from two given segments AB and CD.

In general we have to distinguish 4 cases depending on the location of segments
with respect to their *convex hull*

- none of the segment is strictly inside the hull
- just one segment is inside the hull
- both segments are inside the hull
- the degenerate case where the segments have a common vertex

Let's study first this degenerate case of two segments OA and OB.

"Inside" the angle of the two segments, and "near enough from O",
the locus is made of the angle bisector Oa. Then the distances are the "usual" ones to lines OA and OB.

This condition is restricted by the nearest perpendicular to segments in A or B, here in point a,
intersection of angle bisector with the perpendicular in A.

Farther, the distance of point to OA is the distance from point to A.

The locus becomes then the locus of equidistant points to A and line OB :
a parabola with focus A and directrix OB.

This condition being further restricted when distance from point to OB becomes also
the distance from point to B :
point b on the perpendicular in B to OB.

Then the locus becomes the set of equidistant points to A and B, that is the perpendicular bisector of AB.

If OB <OA, the role of a and b is exchanged.

Outside angle AOB, any point of region R,
limited by the perpendicular lines in O to OA and OB,
has distance to the segments equal to the common distance to O.
Outside this area, there is no point.

If O,A,B are in line, this case degenerates even more into a half plane,
or just the perpendicular in O to AOB.

This method proceeds also with non degenerate cases : the locus is made of pieces of angle bisector(s) and of perpendicular bisector(s), connected by parabola arcs. We show easy that these arcs are tangent to the angle bisectors and perpendicular bisectors. Here tangent in point a to angle bisector and in b to perpendicular bisector.

Because separating the cases of intersection and combining the different pieces of angle
bisectors and perpendicular bisectors is quite complicated,
just case 2 is associated with an applet.
Other cases will have just static examples.

The difficulty with the applet is that the limiting points
are not always on the same lines, and the parabolas don't have always the same focus.

The example below exhibits the locus as being made of part Qz' of the perpendicular bisector of AC, of the arc of parabola QU, with focus A and directrix CD, of a part of angle bisector UV, of an arc of parabola VP, with focus D and directrix AB, and at last of a part Pz of the perpendicular bisector of BD.

The segments and limiting points are not always these ones.

For instance, a case when AB is "farther". Here UV is a part of the perpendicular bisector of AD !

A,B,C,D are draggable but the construction is enabled only when B is inside triangle ACD.

Depending on the location of points, the locus is made of an arc of parabola (magenta) uv "around" B, completed, depending on cases, by parts of angle bisectors of angle O (blue) or the perpendicular bisector of BC or BD (orange) um and vn, then of arcs of parabolas (black) np and mq to connect to the end of locus as parts of perpendicular bisectors of AC and AD (red).

Because the segments intersect in O, in the neighbourhood of O the locus is the two angle bisectors of angle O.

Far away, it is the 4 perpendicular bisector of the convex hull.

The angle bisectors are limited by the perpendicular lines to segments at their ends.

And the same for the perpendicular bisectors. The problem is just to find the right perpendicular...

And also the arcs of parabola have various focii and directrix.

Just give one case as example :

Here IM has focus D and directrix AB, I'M' has focus B and directrix CD, JN has focus C and directrix AB and last J'N' has focus B and directrix CD (another part of the same parabola as I'M').

In each one, the locus is a specific part of some angle bisector, perpendicular bisector or parabola.

May be empty, for instance here the perpendicular bisector of AC has no point in region 1 !

"Visually", it is easy to cut each bisector or parabola by the borders of these regions.

It's another matter within an applet, at least for parabolas. Allowed exchanges of A↔B or C↔D is even worse...

1 | Perpendicular bisector of AC |

2 | Parabola with focus A, directrix CD |

3 | Perpendicular bisector of AD |

4 | Parabola with focus C, directrix AB |

5 | Angle bisectors |

6 | Parabola with focus D, directrix AB |

7 | Perpendicular bisector of BC |

8 | Parabola with focus B, directrix CD |

9 | Perpendicular bisector of BD |

When B=C for instance, the "perpendicular bisector of BC" is undefined, that means it is the whole plane. The full region 7 is then part of the locus. We get back the degenerate case seen first.

Cases AB // CD are worked in similar way :

In such a case, the "angle bisector" is the parallel midway to AB and CD.