algorithm for splitting splines into arc and line I would like to split splines of DXF files to lines and arcs in 2D for a graphic editor. From DXF file, I have extracted the following data:


*

*degree of spline curve

*number of knots and knot vectors

*number of control points and their coordinates

*number of fit points and their coordinates


Using the extracted data, 


*

*start and end point of lines

*start and end point, center point, radius of arcs are needed to find.


I get confused which control points are controlling which knots by seeing the extracted data.
I have found this paper about biarc curve fitting. Is it only for only two connected arc or useful for splines with so many knot points? But, it still needs tangents to calculate the points of arc. Which algorithms should I use to find the points of arcs and lines?
 A: See this question. 
The answers include several useful links.
One of the links provides a very detailed explanation, plus C++ code for biarc approximation.
A: Biarc fitting is to find two tangential connected arcs or one line and one arc that meet the given two end points and two end tangents. You can use it as a core algorithm to approximate a spline with lines and arcs (that are connected with G1 continuity). The algorithm would be something like this:


*

*Compute the start point, end point, start tangent and end tangent of the spline.

*Use biarc algorithm to find the two curves (two arcs or one line and one arc) that meet the two end points and two end tangents.

*Compute the deviation between the two curves and the original spline. If the deviation is sufficiently small, you are done. If not, subdivide the spline at t=0.5 and repeat step 1~3 for the two split spline.


At the end, you should have a series of lines/arc connected with tangent continuity that approximate the spline within a certain tolerance.
