I'm currently working on a library for OpenSCAD which can make 2D sketches with more features. I'm currently struggling with the geometric construction of a fillet given 2 lines in the xy plane and a radius.
Given two lines and a radius, the goal is to construct an arbitrary number of points that form the fillet. The intent is to be able to form a polygon given those points that can approximate the fillet.
I've gotten to the point where the only factor I need to finish generating these points is the distance from the intersection of the two lines to the point of tangency. Any help to find this distance in terms of the lines and the radius of the circle would be greatly appreciated.
Each line is currently stored as a two points in x,y. However, converting them to another form, such as a point and a slope, would be relatively easy. Whichever form makes the question easier is equally easy to implement.

Assuming you are given endpoints, end slopes and radius..$ (x1,y1),(x2,y2),m1,m2, R $
In a geometric constr the full arc can be drawn but for intermediate points one should take up computation.The following Mathematica program can be used to fill/continue on a circular path of given directions and radius. Shall explain if any part is not clear.
If we have radii (curvature) of either sign with same start & arc length: