JMSLTM Numerical Library 7.2.0
com.imsl.math

## Class CsTCB

• All Implemented Interfaces:
Serializable, Cloneable

```public class CsTCB
extends Spline```
Extension of the Spline class to handle a tension-continuity-bias (TCB) cubic spline, also known as a Kochanek-Bartels spline and is a generalization of the Catmull-Rom spline.

Let `xData`, `yData`, and the length of `xData` and `yData`. Class `CsTCB` computes the Kochanek-Bartels spline, a piecewise cubic Hermite spline interpolant to the set of data points for . The breakpoints of the spline are the abscissas. As with all of the univariate interpolation functions, the abscissas need not be sorted.

The values are the knots, so the -th interval is . (To simplify the explanation, it is assumed that the data points are given in increasing order.) The cubic Hermite in the -th segment has a starting value of and an ending value of . Its incoming tangent is

where is the -th tension value, is the -th continuity value, and is the -th bias value. Its outgoing tangent is

The value of the tangent at the endpoint, `left`, is given as:

The value of the tangent at the endpoint, `right`, is given as:

By default the values of the tangents at the leftmost and rightmost endpoints are zero. These values can be reset via the `setLeftEndTangent` and `setRightEndTangent` methods.

The spline has a continuous first derivative () if at each data point the left and right tangents are equal. This is true if the continuity parameters, , are all zero. For any values of the parameters the spline is continuous ().

If for all , then the curve is the Catmull-Rom spline.

The following chart shows the same data points interpolated with different parameter values. All of the tension, continuity, and bias parameters are zero except for the labeled parameter, which has the indicated value at all data points.

Tension controls how sharply the spline bends at the data points. The tension values can be set via the `setTension` method. If `tension` values are near +1, the curve tightens. If the `tension` values are near -1, the curve slackens.

The continuity parameter controls the continuity of the first derivative. The continuity values can be set via the `setContinuity` method. If the `continuity` value is zero, the spline's first derivative is continuous, so the spline is .

The bias parameter controls the weighting of the left and right tangents. If zero, the tangents are equally weighted. If the bias parameter is near +1, the left tangent dominates. If the bias parameter is near -1, the right tangent dominates. The bias values can be set via the `setBias` method.

Example, Serialized Form

• ### Fields inherited from class com.imsl.math.Spline

`breakPoint, coef, EPSILON_LARGE`
• ### Constructor Summary

Constructors
Constructor and Description
```CsTCB(double[] xData, double[] yData)```
Constructs the tension-continuity-bias (TCB) cubic spline interpolant to the given data points.
• ### Method Summary

Methods
Modifier and Type Method and Description
`void` `compute()`
Computes the tension-continuity-bias (TCB) cubic spline interpolant.
`double` `getLeftEndTangent()`
Returns the value of the tangent at the leftmost endpoint.
`double` `getRightEndTangent()`
Returns the value of the tangent at the rightmost endpoint.
`void` `setBias(double[] bias)`
Sets the bias values at the data points.
`void` `setContinuity(double[] continuity)`
Sets the continuity values at the data points.
`void` `setLeftEndTangent(double left)`
Sets the value of the tangent at the left endpoint.
`void` `setRightEndTangent(double right)`
Sets the value of the tangent at the right endpoint.
`void` `setTension(double[] tension)`
Sets the tension values at the data points.
• ### Methods inherited from class com.imsl.math.Spline

`copyAndSortData, copyAndSortData, derivative, derivative, derivative, getBreakpoints, integral, value, value`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### CsTCB

```public CsTCB(double[] xData,
double[] yData)```
Constructs the tension-continuity-bias (TCB) cubic spline interpolant to the given data points.
Parameters:
`xData` - a `double` array containing the x-coordinates of the data. Values must be distinct. `xData` and `yData` must be of the same length.
`yData` - a `double` array containing the y-coordinates of the data. `xData` and `yData` must be of the same length.
• ### Method Detail

• #### compute

`public void compute()`
Computes the tension-continuity-bias (TCB) cubic spline interpolant.
• #### getLeftEndTangent

`public double getLeftEndTangent()`
Returns the value of the tangent at the leftmost endpoint.
Returns:
A `double` value of the tangent at the leftmost endpoint.
• #### getRightEndTangent

`public double getRightEndTangent()`
Returns the value of the tangent at the rightmost endpoint.
Returns:
A `double` value of the tangent at the rightmost endpoint.
• #### setBias

`public void setBias(double[] bias)`
Sets the bias values at the data points.
Parameters:
`bias` - A `double` array of length `xData.length` which contains bias values in the interval [-1,1]. For each point, if the bias value is zero, the left and right side tangents are equally weighted. If the value is near +1, the left-side tangent dominates. If the value is near -1, the right side tangent dominates. By default, all values of `bias` are zero.
• #### setContinuity

`public void setContinuity(double[] continuity)`
Sets the continuity values at the data points.
Parameters:
`continuity` - A `double` array of length `xData.length` which contains continuity values in the interval [-1,1]. For each point, if the continuity value is zero, the curve is at that point. Otherwise, the curve has a corner at that point, but is still continuous (). By default, all values of `continuity` are zero.
• #### setLeftEndTangent

`public void setLeftEndTangent(double left)`
Sets the value of the tangent at the left endpoint.
Parameters:
`left` - A `double` value of the tangent at the leftmost endpoint. The default value is zero.
• #### setRightEndTangent

`public void setRightEndTangent(double right)`
Sets the value of the tangent at the right endpoint.
Parameters:
`right` - A `double` value of the tangent at the rightmost endpoint. The default value is zero.
• #### setTension

`public void setTension(double[] tension)`
Sets the tension values at the data points.
Parameters:
`tension` - A `double` array of length `xData.length` which contains tension values in the interval [-1,1]. For each point, if the tension value is near +1, the curve is tightened at that point. If it is near -1, the curve is slack. By default, all values of `tension` are zero.
JMSLTM Numerical Library 7.2.0