In routine, write and use bulges for one case... Then check for intersection of green lwpolyline and circle; if there are 3 points of intersection (use 'intersectwith method) which will always be true if bulges are opposite, you then switch bulge signs and the result should be like it was drawn in your picture... If intersectwith returns single point or equal points to apex quadrant point of circle, then sign assumptions are correct and routine should terminate without needing of switching bulge signs...
I have tested both solutions succesfully, thanx for it, but I am focussing on Lee's code:
In my example I used a straight polyline (red line) with only 2 points as an example.
But this polyline can also have multiple vertices and possible tangent arc-segments.
In fact there can be multiple circles around the route of the polyline, which need to be avoided.
This means that there may be more vertex points than only PT1 and PT2 (in between or outside)
So I also need to:
List the vertex points and bulges of the existing (red) polyline
Figure out which vertex points are possibly between PT1 and PT2 and if there remove them from the list
Insert the "Bend"
Draw the new polyline
Remove the old polyline
How do i approach step 2?
Other thing is, it does happen (small chance) that the CP circle is exactly on the polyline. This means that the user should have the choice to the re-route the polyline right or left from the circle.