Given 3 points, WP_{N-1}, WP_N, and WP_{N+1}, what is the center, and start / end angles of an arc where WP_N is on the arc, and WP_{N-1}{exit} is on an extended tangent to the start of the arc, and WP{N+1}{enter} is on an extended tangent to the end of the arc. The arc radius is R. For the waypoints, draw a straight line form WP{N-1}{exit} to the WP{N}{enter}. The arc passes through WP{N} and exits at WP_{N}{exit} on a straight line to the WP{N+1}_{enter}. Continue to the final waypoint.
The solution is as follows. Bisect angle formed by WP_{N-1}, WP_N, WP_{N+1} with angle beta. The arc center, WP_N_{center} is approximately on this bisector, at distance R from WP_N. The first, entrance tangent is at angle -beta-90 deg, and the second, exit tangent is at angle beta+90 deg. Move onto the next waypoint and use the exit tangent point as the previous WP. Repeat process on 3rd and subsequent waypoints. When I solve this problem in python, the appears to be a discrepancy between the end of waypoints and arc. Is there a solution for this problem, point on arc, and extended tangents passing through two other points?
Below is a drawing showing the calculate path for 4 waypoints around a square. The path is the green dotted lines and green solid arc, ending with a magenta dotted line to the last point. The arc entrance points are green circles, and the exit points are red squares. The arc center points are blue circles. Obviously the path is wrong. So, I think the math solution above is not correct. Here is the link to the python code. Hmmm, I notice I have all left turns, it would be good to modify the last waypoint so it is above the square, so the last turn is a right turn.

