golib
0.5
|
Cubic Non-uniform non-rational B-spline approximation. More...
#include <gonurbs.h>
Public Member Functions | |
goNUBS (const goCurvef *curve) | |
Constructor. More... | |
goNUBS (const goCurved *curve) | |
Constructor. More... | |
goDouble | getCurveLength () const |
Get curve length. More... | |
bool | calculate () |
Calculate with current control points. More... | |
bool | setControlPoints (const goList< goPointf > &points) |
Calculate with given point list. More... | |
bool | setControlPoints (const goList< goPointd > &points) |
bool | setControlPoints (goList< goPointf >::ConstElement *begin, goList< goPointf >::ConstElement *end, bool closed=false) |
Set control points to given point list. More... | |
bool | setControlPoints (goList< goPointd >::ConstElement *begin, goList< goPointd >::ConstElement *end, bool closed=false) |
bool | setControlPoints (goList< goPointf >::ConstElement *begin, goIndex_t count, bool closed=false) |
Set control points to given point list. More... | |
bool | setControlPoints (goList< goPointd >::ConstElement *begin, goIndex_t count, bool closed=false) |
Set control points to given point list. More... | |
goPointf | operator() (goFloat u) |
Evaluate the B-spline curve at u. More... | |
goNUBS (const goCurvef *curve) | |
goNUBS (const goCurved *curve) | |
goDouble | getCurveLength () const |
bool | calculate () |
bool | setControlPoints (const goList< goPointf > &points) |
bool | setControlPoints (const goList< goPointd > &points) |
bool | setControlPoints (goList< goPointf >::ConstElement *begin, goList< goPointf >::ConstElement *end, bool closed=false) |
bool | setControlPoints (goList< goPointd >::ConstElement *begin, goList< goPointd >::ConstElement *end, bool closed=false) |
bool | setControlPoints (goList< goPointf >::ConstElement *begin, goIndex_t count, bool closed=false) |
bool | setControlPoints (goList< goPointd >::ConstElement *begin, goIndex_t count, bool closed=false) |
goPointf | operator() (goFloat u) |
Cubic Non-uniform non-rational B-spline approximation.
Uses cubic NUBS to approximate a curve. A curve can either be given in the constructor as a goCurve* or as a goList<goPointf> to setControlPoints(). In order to get knots with multiplicity > 0, define points with the desired multiplicity. If you want periodic functions (closed curves), append the first point of the curve at its end. That's not tested, but should suffice.
B is currently calculated recursively. Use de Boor instead.
Currently this class is not compiled. Replace the use of goPoint with goMath::Vector.
Uses cubic NUBS to approximate a curve. A curve can either be given in the constructor as a goCurve* or as a goList<goPointf> to setControlPoints(). In order to get knots with multiplicity > 0, define points with the desired multiplicity. If you want periodic functions (closed curves), append the first point of the curve at its end. That's not tested, but should suffice.
goNUBS::goNUBS | ( | const goCurvef * | curve | ) |
Constructor.
curve | Pointer to the curve object. If 0, no action is taken. If != 0, the curve is approximated and operator() can be used to evaluate the curve. The valid parameter range is [0,getCurveLength()). |
goNUBS::goNUBS | ( | const goCurved * | curve | ) |
Constructor.
curve | Pointer to the curve object. If 0, no action is taken. If != 0, the curve is approximated and operator() can be used to evaluate the curve. The valid parameter range is [0,getCurveLength()). |
bool goNUBS::calculate | ( | ) |
Calculate with current control points.
Basically only calculates the knot values.
goDouble goNUBS::getCurveLength | ( | ) | const |
Get curve length.
The valid parameter range for operator() can be determined with this function and is [0,getCurveLength()).
goPointf goNUBS::operator() | ( | goFloat | u | ) |
Evaluate the B-spline curve at u.
If it nags someone too much, return the end point when nubs.operator()(nurbs.getCurveLength()) is requested.
Currently intervals are searched for linearly. Improve that when there's time.
Store the control points in an array additionally to speed up access.
u | Point to evaluate at. Must be in [ 0,getCurveLength() ). Note the half-open interval. |
Calculate with given point list.
Copies points
to the internal point list, adds the last point twice and calls calculate().
points | The point list describing the curve to be approximated. |
bool goNUBS::setControlPoints | ( | goList< goPointd >::ConstElement * | begin, |
goIndex_t | count, | ||
bool | closed = false |
||
) |
Set control points to given point list.
Copies points
to the internal point list, adds the last point twice and calls calculate().
points | The point list describing the curve to be approximated. |
bool goNUBS::setControlPoints | ( | goList< goPointf >::ConstElement * | begin, |
goIndex_t | count, | ||
bool | closed = false |
||
) |
Set control points to given point list.
Copies points
to the internal point list, adds the last point twice and calls calculate().
points | The point list describing the curve to be approximated. |
bool goNUBS::setControlPoints | ( | goList< goPointf >::ConstElement * | begin, |
goList< goPointf >::ConstElement * | end, | ||
bool | closed = false |
||
) |
Set control points to given point list.
Copies points
to the internal point list, adds the last point twice and calls calculate().
points | The point list describing the curve to be approximated. |