You may move the different construction elements to see how the
construction works.
This solution works even when P is moved to the other side of g. This
happens because the other intersection of the two circles is automatically kept
away from the already known point P.