I want to know whether there exists an existing algorithm for this problem or if it can be mapped to an existing one.
Problem
You are in 2D and want to make some string art using nails on wooden board. For that, you start at a certain nail from the set, all of which are irregularly placed on the board. You then linearly move in discrete steps around the nail board until you reach the end nail. Now, you tighten the string and want to know the path of the string and also which nails the string touches.
Output: Path of the tightened string and its nails.
Example: The orange path is the line that you took around the board. The green line is the final tightened string. Note that direct connections like the start with the nail X are illegal because of the taken path.
An alternative analogy: You fix a rope around a tree in a wood. Then you dash around the trees in linear pieces. You stop at a certain tree and pull really hard at the rope, so it is tightened.
The problem seems a shortest path problem, but with an extra constraint, i.e. only some nodes/nails may be used.