Conversion Between Bezier and Catmull-Rom Splines
CConversion Between B´ezier and Catmull-Rom Splines (cid:63)
Soroosh Tayebi Arasteh and Adam Kalisz
Department of Electrical, Electronic and Communication Engineering, Information Technology (LIKE),Friedrich-Alexander-Universit¨at Erlangen-N¨urnberg, Am Wolfsmantel 33, Erlangen, Germany { soroosh.arasteh, adam.kalisz } @fau.de November 16, 2020
Abstract.
Splines are one of the main methods of mathematically representing complicated shapes,which have become the primary technique in computer graphics for modeling complex surfaces. Amongall, B´ezier and Catmull-Rom splines are of the most used in the subfields of engineering. In this document,we focus on conversion of splines rather than going through the properties of them, i. e., converting thecontrol points of a spline to the control points of another spline, which results in approximately thesame curve, as the spline before conversion represents.
Keywords:
Bezier · Catmull-Rom · Spline Conversion · Computer Graphics
As the field of computer graphics develops, techniques for modeling complex curves and surfaces are beingincreasingly important. A major technique is the use of parametric splines in which a curve is defined bypiecing together a succession of curve segments, and surfaces are defined by stitching together a mosaic ofsurface patches [1]. Splines are a mathematical means of representing a curve, by specifying a series of pointsat intervals along the curve and defining a function that allows to interpolate along the curve to retrieveadditional points within an interval to be calculated. The points that define a spline are known as
ControlPoints . [2]In this report, we will not go through the properties of splines. Firstly, we will give a brief explanationof B´ezier and Catmull-Rom Splines. Then, we go through the conversion equations. For a more detailedinformation on B´ezier curves, you may refer to [4]. Note that by conversion, we mean conversion of controlpoints of a spline to the control points (in the same order as the original spline) of another spline, whichresults in approximately the same curve as the spline before conversion . In the end, we prove the equationswith a numerical example. We use bold-face notation for vector representation here. A bezier 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´ezier spline,respectively.A cubic B´ezier curve can be written in a matrix form by expanding the analytic definition of the curveinto its Bernstein polynomial coefficients, and then writing these coefficients in a matrix form using thepolynomial power basis [6]. The Bernstein polynomials of degree n are defined by Equ. (1). B i,n ( t ) = (cid:18) ni (cid:19) t i (1 − t ) n − i (1) (cid:63) This short technical report was written as a part of a research project at the FAU LIKE. This is just a translatedversion. The original document was written in German. To encourage reproducibility, the C For more information on the Bernstein polynomials, see [5] and [8]. a r X i v : . [ c s . G R ] N ov S. Tayebi Arasteh et al.(a) (b) (c)
Fig. 1: (a) A two-point B´ezier spline. (b) A three-point (quadratic) B´ezier spline. (c) A four-point (cubic)B´ezier spline. [3]Writing the Bernstein polynomials in matrix form, we have,
Bezier ( t ) = (cid:88) i =0 P i B i ( t ) = (1 − t ) P + 3 t (1 − t ) P + 3 t (1 − t ) P + t P (2)= (cid:2) t t t (cid:3) · − − − − · P P P P . (3)Equ. (2) is valid for any number of dimension as P i generally is a vector. Unlike B´ezier splines, Catmull-Rom is defined for only 4 control points (see Fig. 2). It is an interpolatingspline, i. e., the curve goes, this time, through its control points, P , P , P , P , and it is only drawn from P to P . The curve is named after Edwin Catmull and Raphael Rom. The principal advantage of this techniqueis that the points along the original set of points also make up the control points for the spline curve [10].Fig. 2: Catmull–Rom spline interpolation with four points. [9]Catmull-Rom splines are based on the concept of tension: the higher the tensions, the shorter the tangentsat the departure and arrival points. When tension equals 1, the resulting segments between control points willbe straight lines. The basic Catmull-Rom curve arrives and departs with tangents equal to half the distancebetween the two adjacent points. The matrix form of a Catmull-Rom spline is shown in Equ. (4), CatmullRom ( t ) = 12 · (cid:2) t t t (cid:3) · − τ τ τ τ − − τ − − τ − τ − τ τ − τ . P (cid:48) P (cid:48) P (cid:48) P (cid:48) (4) P (cid:48) i , i ∈ { , , , } show the Catmull-Rom spline control points.´ezier Spline to Catmull-Rom Spline and Vice-Versa Conversion 3 where τ is the tension factor . See [7] for the proof of Equ. (4) with τ = 1. We will use only cubic splines for both Catmull-Rom and B´ezier here, as the Catmull-Rom splines are onlydefined with four control points. You can always concatenate multiple splines to create your desired curve.We will be showing the conversion from Catmull-Rom curves to B´ezier curves and vice-versa for the tensionthat the processing language uses for its Catmull-Rom algorithm.Comparing Equ. (3) and Equ. (4), we wish to find the transformation matrix A in order to convert fromCatmull-Rom to B´ezier, (cid:2) t t t (cid:3) · · − τ τ τ τ − − τ − − τ − τ − τ τ − τ . P (cid:48) P (cid:48) P (cid:48) P (cid:48) = (cid:2) t t t (cid:3) · − − − − · A · P P P P (6) (cid:2) t t t (cid:3) · M (cid:48) · P (cid:48) P (cid:48) P (cid:48) P (cid:48) = (cid:2) t t t (cid:3) · M · P P P P (7)with M and M (cid:48) being the following matrices, M (cid:48) = 12 · − τ τ τ τ − − τ − − τ − τ − τ τ − τ (8) M = − − − − · A (9)The difference is somewhere in the M and M (cid:48) matrices, since t and the coordinate values are identical.Therefore, we should solve the matrix equation in Equ. (10).12 · − τ τ τ τ − − τ − − τ − τ − τ τ − τ = − − − − · A (10) In many references, you may find the matrix form of the Catmull-Rom splines as,
CatmullRom ( t ) = 12 · (cid:2) t t t (cid:3) · − − − − − . P (cid:48) P (cid:48) P (cid:48) P (cid:48) (5)which is the case when τ = 1. S. Tayebi Arasteh et al. We left-multiply both sides by the inverse of the B´ezier matrix, to get rid of the B´ezier matrix on the rightside of the equals sign, − − − − − · · − τ τ τ τ − − τ − − τ − τ − τ τ − τ = − − − − − · − − − − · A = I · A = A (11)which brings us to Equ. (12). 16 · − τ τ τ − τ = A. (12)Multiplying this A with our coordinates will give us a proper B´ezier matrix expression again, as in Equ. (13)and Equ. (14). (cid:2) t t t (cid:3) − − − − · · − τ τ τ − τ · P P P P (13)= (cid:2) t t t (cid:3) − − − − · P P + P − P · τ P − P − P · τ P . (14)Thus, a Catmull-Rom to B´ezier conversion, based on coordinates, requires turning the Catmull-Romcoordinates on the left into the B´ezier coordinates on the right (with τ being our tension factor), accordingto Equ. (15). P (cid:48) P (cid:48) P (cid:48) P (cid:48) CatmullRom ⇒ P P + P − P · τ P − P − P · τ P Bezier (15)And in the same way, a B´ezier to Catmull-Rom conversion instead requires turning the B´ezier coordinateson the left into the Catmull-Rom coordinates on the right. Note that, there is no tension factor this time,because B´ezier curves do not have any. Converting from B´ezier to Catmull-Rom is simply a default-tensionCatmull-Rom curve, based on Equ. (16). P P P P Bezier ⇒ P (cid:48) + 6 · ( P (cid:48) − P (cid:48) ) P (cid:48) P (cid:48) P (cid:48) + 6 · ( P (cid:48) − P (cid:48) ) CatmullRom (16) ´ezier Spline to Catmull-Rom Spline and Vice-Versa Conversion 5
In this section, we will use a set of exemplary control points in order to validate the transformation equations.Let us have a cubice B´ezier spline with the following 3-dimensional control points as in the following, P = (1 . , . , . P = (2 . , . , . P = (3 . , . , . P = (4 . , . , . . Using Equ. (16), we get the following control points for the Catmull-Rom spline with the tension factor τ = 1, P (cid:48) = ( − . , − . , − . P (cid:48) = (1 . , . , . P (cid:48) = (4 . , . , . P (cid:48) = (7 . , . , . . Now, we replace the set of control data points in Equ. (3) and with a random choice of t = 0 .
2, we get thefollowing,
Bezier (0 .
2) = (cid:2) . .
04 0 . (cid:3) · − − − − · . . . . = 1 . . (17)The obtained value should be the same, when using Equ. (4) with t = 0 . . CatmullRom (0 .
2) = 12 · (cid:2) . .
04 0 . (cid:3) · − − − − − . P (cid:48) P (cid:48) P (cid:48) P (cid:48) . (18)Solving the matrix equation, we get, P (cid:48) = ( − . , − . , − . P (cid:48) = (1 . , . , . P (cid:48) = (4 . , . , . P (cid:48) = (7 . , . , . . Now, we choose another random time t = 0 .
64 and follow the same procedure as above,
Bezier (0 .
64) = (cid:2) .
64 0 . . (cid:3) · − − − − · . . . . = 2 . . CatmullRom (0 .
64) = 12 · (cid:2) .
64 0 . . (cid:3) · − − − − − . P (cid:48) P (cid:48) P (cid:48) P (cid:48) . (20)Solving the matrix equation, we again get the following values, P (cid:48) = ( − . , − . , − . P (cid:48) = (1 . , . , . P (cid:48) = (4 . , . , . P (cid:48) = (7 . , . , . . S. Tayebi Arasteh et al.
In this document, we focused on conversion of control points of a cubic B´ezier spline to those of a Catmull-Romspline and vice-versa, and confirmed it with an example for the conversion from B´ezier to Catmull-Rom. Itwas shown that, to do so, according to Equ. (15) and Equ. (16), we just need some simple transformations ofthe positions of the control points.