Approximation of reaction lines by single-segment parametric cubic Bezier curves

 While playing with THERMOCALC data on reactions in CorelDRAW I've noticed that almost any reaction line can be represented by a parametric cubic single-segment Bezier curve with a great precision (at least higher than uncertainties of output P–T values), e.g.:
Bezier curves vs. Polylines
 I decided that usage of parametric cubic Bezier curves on diagrams in TC_Comb (as well as in TriQuick) is very promising as they have a number of advantages if compared with traditional polyline representations (and with non-parametric curves):

  • Smooth lines should represent data more correctly, especially if you are dealing with intersections of several curved lines in a single point and trying to analyze enlarged fragments of diagrams;
  • Any single-segment cubic Bezier curve is defined by 4 points only (i.e. by 8 values) that reduces memory usage;
  • Parametric form of equation is identical for any reaction curve, so you can throw out recognition of slopes: horizontal, vertical and strongly curved lines are not differentiated;
  • Mathematical expressions of cubic Bezier curves (including their derivatives) are very short and simple;
  • Fast and effective drawing routines for cubic Bezier curves are implemented in core modules of all operating systems that have graphic engines;
  • At least, smooth lines look better!

 The main disadvantage is that development of approximation routine is a non-trivial task and it's difficult to find a ready-to-use good algorithm: Bezier fitting is an iterative process with alternating LSF and re-parameterization procedures. Some basic operations (like finding intersections of Bezier curves) are also not easy to implement. However, the latter operations are not required for simple visualization tasks. TC_Comb uses its own iterative Bezier curve fitting algorithm which is not optimal but produce good approximations in most cases. The core subroutines of this algorithm are taken from the MATHLAB project of Dr. Murtaza Khan (who developed a simple and highly optimized LSF procedure which finds two intermediate control points of the cubic Bezier curve at fixed end-points) and from the paper of M. Plass and M. Stone (where the re-parameterization expressions for cubic Bezier curves are described), with some additional actions like scaling of input data, processing of trivial cases and rearrangements of ahchor points after sudden changes of their order at LSF. TC_Comb version of this algorithm also checks resulting curve for maximum deviations from original points and leave polyline representation if problems were detected.
 I've also added a small Delphi 7 project for those amateur programmers who are interested in my implementation of Bezier fitting procedures. I used it at the development stage for testing purposes. This project includes one more LSF algorithm of Jim Herold which finds all 4 control points of a Bezer curve segment (i.e. end-points are not fixed). The program writes TVL-files that can be loaded to the TriQuick program. You can use this project as a starting point for your own routines (e.g. if you want to implement more or less optimal approximation of multisegment Bezier curves).


  1. Dr. Murtaza Khan, 2007-2009. Cubic Bezier least square fitting // MATHLAB project at
  2. M. Plass & M. Stone, 1983. Curve-fitting with piecewise parametric cubics // SIGGRAPH’83 Proceedings, p. 229–239.
  3. Jim Herold, 2012. Least Squares Bezier Fit // Article online at; JAVA implementation at SourceForge.