Conversion Between Cubic Bezier Curves and Catmull-Rom Splines

Splines are one of the main methods of mathematically representing complicated shapes, which have become the primary technique in the fields of Computer Graphics (CG) and Computer-Aided Geometric Design (CAGD) for modeling complex surfaces. Among all, B\'ezier and Catmull-Rom splines are the most common in the sub-fields of engineering. In this paper, we focus on conversion between cubic B\'ezier and Catmull-Rom curve segments, rather than going through their properties. By deriving the conversion equations, we aim at converting the original set of the control points of either of the Catmull-Rom or B\'ezier cubic curves to a new set of control points, which corresponds to approximately the same shape as the original curve, when considered as the set of the control points of the other curve. Due to providing simple linear transformations of control points, the method is very simple, efficient, and easy to implement, which is further validated in this paper using some numerical and visual examples.

and flexible, when implemented in a computer software. Especially with curves, a software engineer is usually presented with a plethora of possible shape representations to choose from. The wide range of candidates and their specific advantages and disadvantages motivate the application of this work. A brief overview of the main purpose of curves and splines as well as the necessity of a conversion method in engineering fields will prepare the reader for the subsequent theory and evaluation part within this paper.
Designers in the car industry often need to construct clay models or sketches of vehicles, where the mathematical representation needs to allow for interactive modifications to curve properties, such as curvature and continuity. Furthermore, one of the key properties of the available mathematical representations is the distinction between interpolating and approximating curves [10]. This property is related to whether a curve goes through its Control Points or not and can be observed as one of the main differences between the two shape representations discussed in this work. Indeed, the reason for conducting this research was the need to support two different curve representations in a common file format, and therefore, the remainder of this paper is focused on proposing a closed-form conversion equation.
Furthermore, according to the German Association of the Automotive Industry (VDA) 1 , different manufacturers and their subcontractors have different geometric modeling systems for curve and surface representations. Thus, another motivating view on exchanging data between different geometric modeling systems to compensate differences in the types of polynomial bases, maximum polynomial degrees and mesh sizes of curve and surface representations is discussed more thoroughly in [14].

Engineering Purpose and Related Work
As the field of Computer Graphics (CG) develops, techniques for modeling complex curves and surfaces are being increasingly important. An example may be the rendering of highly detailed landscapes which need to be subdivided (tessellated) depending on the viewing distance to reduce the processing time for a geometry that is barely visible from the current camera viewpoint [12,30]. One of the major techniques to realize such dynamic tessellation algorithms is the use of parametric splines in which a curve is defined by piecing together a succession of curve segments, and especially, surfaces defined by stitching together a mosaic of surface patches [1].
Splines are a mathematical means of representing a complex curve. For example, it is not possible to define a circle using only a single cubic Bézier curve. Therefore, a common approximation to model a circle is to use four Bézier curve segments [7]. Eventually, a complete path can be defined using a series of points at intervals along the curve segments and defining a function that allows to interpolate along the curve to retrieve additional points within each interval to be calculated. This is often the first step when creating procedural virtual worlds, i.e., generating smooth and infinite highways using Catmull-Rom splines in games [8]. The impressive power of splines is demonstrated when procedural landscapes and roads are combined to create entire virtual city models randomly, as can be seen, for instance in the SceneCity Blender addon 2 . As seen with the CG examples, it is possible to generate paths and surfaces using splines. In addition, Splines can be used to animate objects or virtual cameras along predefined paths [27]. Recently, the research community involved in solving the inverse problem to CG, namely, Computer Vision (CV), increasingly discovers splines for recovering the real camera movement from image sequences. In robotics, related research is often concerned with solving the visual Simultaneous Localization And Mapping (SLAM) problem. However, since cameras usually take pictures at specific points in time, the resulting estimated trajectory is discrete. Imposing constraints on the camera path using splines has shown advantages in handling a common image sensor deficiency called rolling shutter, where the image exhibits a pixel warping deformation (informally often called a Jello Effect) due to a rowwise exposure [5]. Describing the camera trajectory using continuous B-splines offers the advantage that any exposure time along the path can be interpolated and thus allows for correcting the rolling shutter for both monocular [24] and stereo (RGB-D) [20] cameras. To predict and plan the future paths for Automated Driving Systems (ADS), while taking into account obstacles and driving comfort, it was shown that Bézier curves are a reliable solution for an optimal trajectory generation [11,21].
This short review of interdisciplinary research contains many different types of spline representation, such as Bézier [7,11,21], Catmull-Rom [8], B-Splines [20,24] and Non-uniform Rational B-Spline (NURBS) [12] surfaces. This shows the relevance of providing conversion methods between the various representations of which one is discussed in this paper.

Paper Structure and Contributions
In this paper, we do not go through the properties and details of Bézier and Catmull-Rom Splines, but rather the aim is to focus on the conversion equations. First, we give a brief explanation of Bézier curves in Sec. 2 as well as a brief explanation of Catmull-Rom Splines in Sec. 3. Then, we go through the conversion equations in Sec. 4. Note that by conversion, we mean conversion of control points of a curve to the control points of another curve, which results in approximately the same curve as the curve before conversion represents 3 . In Sec. 5, we validate the equations with some numerical and graphical examples. We use bold-face notation for vector representation here. Sec. 6 discusses the conversion equations with regard to the real-world applications and the limitations and proposes some potential future work. Finally, the conclusions are stated in Sec. 7.

Bézier Curves
There are two basic ways of defining a curve-in terms of the polygon vertices, and in terms of the polygon sides [10]. Even though, the latter is the form, which was originally used by Pierre Bézier [2][3][4], we consider the former throughout our paper. There are two reasons for developing a formulation of the Bézier curve in terms of polygon vertices rather than polygon sides. To begin with, the formulation becomes more elegant. Furthermore, as a general principle, it is better to program in terms of absolute vectors rather than a chain of relative vectors, irrespective of the particular user interface, when transformations such as rotation are to be applied to the vectors, because rounding errors do not have the cumulative effect which sometimes give rise to poor drawings. This can be particularly noticeable when transformations are performed, for reasons of speed, in a small satellite graphics computer [10].
A parametric Bézier curve is defined by its control points. The curve does not necessarily go through the control points. There may be 2, 3, 4 or more. For instance, Fig. 1 shows a linear, a quadratic, and cubic Bézier curve, respectively. The figures are drawn using a geometric approach called "de Casteljau's algorithm". It is the most common approach for drawing Bézier curves in CAGD. For more details on the algorithm, see [9].
A cubic Bézier curve can be written in a matrix form by expanding the analytic definition of the curve into its Bernstein polynomial coefficients, and then writing these coefficients in a matrix form using the polynomial power basis [15]. The Bernstein polynomials 4 of degree n are defined by Eq. 1. For more details on Bézier curves, see [18]. (1) A Bézier curve uses Bernstein polynomials as basis. A cubic (degree 3 or order 4) is represented by the following,

Catmull-Rom Splines
Catmull-Rom splines are a family of cubic interpolating splines formulated such that the tangent at each point P i is calculated using the previous and next point on the spline [29]. Unlike a Bézier curve, a (Centripetal) Catmull-Rom spline is defined for only 4 control points (see Fig. 2), i.e., a single Catmull-Rom segment is cubic. As it is an interpolating spline, the curve goes, through its control points, P 0 , P 1 , P 2 , P 3 , and it is only drawn from P 1 to P 2 (Fig. 2). The curve is named after Edwin Catmull and Raphael Rom. The principal advantage of this technique is that the points along the original set of points also make up the control points for the spline curve [6].
Catmull-Rom splines are based on the concept of "tension": the higher the tensions, the shorter the tangents at the departure and arrival points. It affects how sharply the curve bends at the (interpolated) control points [29]. When tension is set to 1 (as it often is), the resulting segments between control points will be straight lines. The basic Catmull-Rom curve arrives and departs with tangents equal to half the distance between the two adjacent points.
The matrix form of a Catmull-Rom 5 spline is shown in Eq. 4, where τ is the tension factor 6 . See [17] for the proof of Eq. 4 with τ = 1.

Conversion
We will use only cubic splines for both Catmull-Rom and Bézier throughout this paper, as the Catmull-Rom splines are only defined with four control points. It is always possible to concatenate multiple splines to create the desired curve. A series of unique cubic polynomials are fitted between each of the data points, with the stipulation that the curve obtained be continuous and appear smooth [22]. As a matter of fact, in industrial applications, it is often found that a particular curve segment is not sufficiently powerful or flexible (i.e., which is the case when τ = 1. it does not have sufficient degrees of freedom) to adopt a desired shape [10]. Comparing Eq. 3 and Eq. 4, we wish to find the transformation matrix A in order to convert from Catmull-Rom to Bézier, Consequently, we have, with M and M being the following matrices, The difference is somewhere in the M and M matrices, since t and the coordinate values are identical. Therefore, we should solve the matrix equation in Eq. 10.
We left-multiply both sides by the inverse of the Bézier matrix, to get rid of the Bézier matrix on the right side of the equals sign, which brings us to Eq. 12.
Multiplying this A with our coordinates will give us a proper Bézier matrix expression again, as in Eq. 13 and Eq. 14. (13) Thus, a Catmull-Rom to Bézier conversion, based on coordinates, requires turning the Catmull-Rom coordinates on the left into the Bézier coordinates on the right (with τ being our tension factor), according to Eq. 15.
In addition, in the same way, a Bézier to Catmull-Rom conversion instead requires turning the Bézier coordinates on the left into the Catmull-Rom coordinates on the right. Note that, there is no tension factor this time, because Bézier curves do not have any. Converting from Bézier to Catmull-Rom is simply a default-tension Catmull-Rom curve, based on Eq. 16.

Experiments and Results
In this section, we use sets of exemplary control points in order to validate the transformation equations.

Numerical Analysis
Having the fact that we only consider some random values here, this part cannot be considered as a mathematical proof. However, it gives a sound overview of how the conversion equations (Eq. 15 and Eq. 16) work.
Looking at the equations, it is trivial that the conversion equations are valid for any number of dimensions. In this part, we explain our examples with 3-dimensional (3D) control points.
In the following, first, we validate the conversion from cubic Bézier curves to cubic Catmull-Rom splines by experimenting two random timepoints. And in the second part, we do the reverse and validate the conversion from cubic Catmull-Rom splines to cubic Bézier curves by experimenting two other random timepoints.

Conversion from Bézier to Catmull-Rom
Let us have a cubice Bézier curve with the following 3D control points, The obtained value should be the same, when using Eq. 4 with t = 0.2, Solving the matrix equation, we get the following control points, which are equal to the results of using Eq. 16.
Another timepoint Now, to show the equation is valid for any timepoint, we choose another random time t = 0.64 and follow the same procedure as above for the same control points, Bezier(0.64) = 1 0.64 0.4096 0.262144 2.920 = CatmullRom(0.64) Solving the matrix equation, we again get the following values, which are again equal to the results of using Eq. 16.

Conversion from Catmull-Rom to Bézier
In this part, we do the reverse and start with a cubic Catmull-Rom spline with the following 3D control points, Replacing the set of control data points in Eq. 4 and with a random choice of t = 0.45, we get the following, The obtained value should be the same, when using Eq. 3 with t = 0.45, 2.5411 = Bezier(0.45) Solving the matrix equation, we again get the following values, Another timepoint Now, to show the equation is valid for any timepoint, we choose another random time t = 0.32 and follow the same procedure as above for the same control points, Solving the matrix equation, we again get the following values,

Graphical Fitting
In this part, we aim at showing the validity of the conversion equations (Eq. 15 and Eq. 16) by illustrating graphical examples. For the ease of illustration, we assume 2-dimensional (2D) curves in this part. Figure 3a shows a cubic Bézier curve which is drawn for 1000 timepoints (t ∈ [0, 1] with a step size of 0.001). Furthermore, the aforementioned figure is drawn using the following randomly-generated 2D control points,  Fig. 3b illustrates the resulting curve, which is almost the same as Fig. 3a.
In a similar way, Fig. 4 shows the reverse conversion from Catmull-Rom to Bézier using Eq. 15 and the following randomly-generated 2D control points and the resulting converted control points,

Discussion
The method proposed in this work allows for converting control points between Bézier and Catmull-Rom definitions.
This conversion can be applied in situations, where one of these mathematical representations is not supported in specific software implementations and thus allows to use data, such as 2D drawings, 3D camera trajectories or surfaces across individual software pipelines. For instance, the open source 3D creation suite Blender does not support Catmull-Rom curve primitives 7 but it does support Bézier curves. Therefore, one of the many applications of the proposed method in this paper would be to convert the control points of a Catmull-Rom curve to the Bézier representation in order to be able to draw the curve in Blender. This work has also some limitations. The proposed method is solely valid for cubic curve segments, i.e., curves which are defined by four control points. However, Bézier curves may be defined with an arbitrary number of control points and consequently, contain a higher-degree polynomial. The advantage of lower-degree polynomials is less computations during both the evaluation of the curve and the calculation of derivatives (comparing the definitions in Eq. 1 and Eq. 2, the number of summations/loops depends on the degree of the curve). Therefore, the higher the degree, the higher the number of evaluations. In order to use our proposed method with higher-degree curves, additional techniques such as Degree Reduction [26] or Curve Subdivision using De Casteljau's algorithm [23] need to be applied to the curve prior to type conversion. Moreover, B-Splines might be utilized in many applications instead of Bézier splines, due to the fact that they could provide finer local shape control by introducing a knot vector. Even though there is a conversion method between B-Splines and Bézier splines [25], the authors are not aware of a method to directly convert between B-Splines and Catmull-Rom splines. Such generalizations to other spline representations are expected to be formulated in future research.

Conclusion
In this paper, we focused on conversion of control points of a cubic Bézier curve to those of a Catmull-Rom curve and vice-versa. It was shown that, to do so, according to Eq. 15 and Eq. 16, we merely need basic linear transformations of the positions of the control points. Moreover, we illustrated that the equations are valid for any timepoint and for control points with arbitrary number of dimensions.