For each node P find the vectors of neighboring edges and determine unit normals na, nb to them, directed in the same direction with respect to the polyline (let it be called external).

Build the external vector of the bisector as the sum of normals, normalize it
bis = na + nb bis = bis / Length(bis)
To provide the necessary distance d to new segments, the length of the bisector l must be
l = d / Cos(fi/2)
where fi is the angle between the normals
fi = atan2(crossproduct(na,nb), dotproduct(na,nb))
Option without trigonometry:
Cos(fi/2) = Sqrt(1+dotproduct(na,nb)) или l = d / Sqrt(1+dotproduct(na,nb))
And finally, the new polyline node:
P' = P + l * bis
In the general case, loops and the like may appear on the "broken polyline" even in the absence of self-intersections of the base polyline. effects.