Spline Library for a Multitude of Programming Languages
Public Attributes | List of all members
tsDeBoorNet Struct Reference

#include <tinyspline.h>

Public Attributes

struct tsDeBoorNetImplpImpl

Detailed Description

Represents the output of De Boor's algorithm. It is used to evaluate a spline at given knots by iteratively computing a net of intermediate values until the result is available:


All points of a net are stored in 'points' (ts_deboornet_points). The resultant point is the last point in 'points' and, for the sake of convenience, can be accessed with 'ts_deboornet_result'.

Two dimensional points are stored as follows:

[x_0, y_0, x_1, y_1, ..., x_n-1, y_n-1]

Tree dimensional points are stored as follows:

[x_0, y_0, z_0, x_1, y_1, z_1, ..., x_n-1, y_n-1, z_n-1]

... and so on. The output also supports homogeneous coordinates (cf. tsBSpline).

There is a special case in which the evaluation of a knot value 'u' returns two results instead of one. It occurs when the multiplicity of 'u' ( s(u) ) is equals to the order of a spline, indicating that the corresponding spline is discontinuous at 'u'. This is common practice for B-Splines (and NURBS) consisting of connected Bezier curves where the endpoint of curve 'c_i' is equal to the start point of curve 'c_i+1'. Yet, the end point of 'c_i' and the start point of 'c_i+1' may still be completely different, yielding to visible gaps. In such case (s(u) == order), 'points' stores only the two resultant points (there is no net to calculate) and 'result' points to the first point in 'points'. Since having gaps in splines is unusual, both points in 'points' are generally equals, making it easy to handle this special case by accessing 'result' as usual. However, you can access both points if necessary:

ts_deboornet_result(...)[0] ...       // Stores the first component of
                                      // the first result.

ts_deboornet_result(...)[dim(spline)] // Stores the first component of
                                      // the second result.

As if this wasn't complicated enough, there is an exception for this special case, yielding to exactly one result (just like the regular case) even if 's(u) == order'. It occurs when 'u' is the lower or upper bound of a spline's domain. For instance, if 'b' is a spline with domain [0, 1] and is evaluated at 'u = 0' or 'u = 1' then 'result' is always a single point regardless of the multiplicity of 'u'.

In summary, three different types of evaluation exist: i) the regular case, in which all points of the corresponding net are returned, ii) a special case, in which exactly two points are returned (required for splines with gaps), and iii) the exception of ii), in which exactly one point is returned even if 's(u) == order'. All in all this looks quite complex (and actually it is), but for most applications you do not have to deal with this. Just use 'ts_deboornet_result' to access the outcome of De Boor's algorithm.

+ Collaboration diagram for tsDeBoorNet:

Member Data Documentation

◆ pImpl

struct tsDeBoorNetImpl* tsDeBoorNet::pImpl

The actual implementation.

The documentation for this struct was generated from the following file: