 Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.

# Ellipse Specification Using Vectors

### Trigonometric Splines

For the purpose of the application I present here, think of splines as a means used to mathematically "connect the dots" with a smooth curve in some application where you are interested in defining a curve of arbitrary shape using movable points to control the shape of the curve. An interpolating uniform spline such as the Catmull-Rom spline, or the interpolating TSpline used in this algorithm, is controlled by a set of control points (commonly known as "knots"). Splines are defined piecewise, each piece being determined by four control points—the two preceding and two following the curve segment in sequence. Figure 3 shows a sample spline curve segment along with its control points.

The interpolating TSpline used in this algorithm is defined by a set of parametric equations (which form a basis curve) and control points, each arranged in vertical/horizontal vectors that are combined by means of matrix multiplication. They are arranged in vectors and given by the equations in Figure 4.

The TSpline basis is formed from a single trigonometric function with a period equal to four units. Each unit segment is then shifted to [0,1] to form the four basis spline function curves (Figure 5). Note in the upper graph that all of the zero crossings occur on unit intervals, except for the central part of the graph, which has a value of 1.0. The result can be seen in the lower graph where F2 and F3 have values of 1.0, which when multiplied by P2 and P3 yield the coordinates of P2 and P3 exactly, ensuring that the resulting curve segment interpolates P2 and P3. (Multiply the x and y components of P2 and P3 by 1.0, and you will get P2 and P3, respectively. The other curve segments, multiplied by 0.0, will contribute exactly 0.0 to the calculation.) Figure 3: Sample spline curve segment along with its control points. Figure 4: Equations that define the interpolating TSpline. Figure 5: Four basis spline function curves.

### More Insights To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.

## Featured Reports ## Featured Whitepapers 