#include <nurbs.h>
Inheritance diagram for PLib::NurbsCurve:
Public Methods | |
NurbsCurve () | |
NurbsCurve (const NurbsCurve< T, N > &nurb) | |
NurbsCurve (const Vector< HPoint_nD< T, N > > &P1, const Vector< T > &U1, int deg=3) | |
NurbsCurve (const Vector< Point_nD< T, N > > &P1, const Vector< T > &W, const Vector< T > &U1, int deg=3) | |
virtual | ~NurbsCurve () |
int | degree () const |
const Vector< HPoint_nD< T, N > > & | ctrlPnts () const |
const HPoint_nD< T, N > | ctrlPnts (int i) const |
const Vector< T > & | knot () const |
T | knot (int i) const |
void | resize (int n, int Deg) |
virtual void | reset (const Vector< HPoint_nD< T, N > > &P1, const Vector< T > &U1, int deg) |
virtual NurbsCurve & | operator= (const NurbsCurve< T, N > &) |
virtual HPoint_nD< T, N > | operator() (T u) const |
HPoint_nD< T, N > | hpointAt (T u) const |
HPoint_nD< T, N > | hpointAt (T u, int span) const |
void | deriveAtH (T u, int, Vector< HPoint_nD< T, N > > &) const |
void | deriveAt (T u, int, Vector< Point_nD< T, N > > &) const |
void | deriveAtH (T u, int, int, Vector< HPoint_nD< T, N > > &) const |
void | deriveAt (T u, int, int, Vector< Point_nD< T, N > > &) const |
Point_nD< T, N > | derive3D (T u, int d) const |
HPoint_nD< T, N > | derive (T u, int d) const |
Point_nD< T, N > | normal (T u, const Point_nD< T, N > &v) const |
HPoint_nD< T, N > | firstD (T u) const |
HPoint_nD< T, N > | firstD (T u, int span) const |
Point_nD< T, N > | firstDn (T u) const |
Point_nD< T, N > | firstDn (T u, int span) const |
T | basisFun (T u, int i, int p=-1) const |
void | basisFuns (T u, int span, Vector< T > &N) const |
void | dersBasisFuns (int n, T u, int span, Matrix< T > &N) const |
T | minKnot () const |
T | maxKnot () const |
int | findSpan (T u) const |
void | findMultSpan (T u, int &r, int &s) const |
int | findMult (int r) const |
int | findKnot (T u) const |
T | getRemovalBnd (int r, int s) const |
void | removeKnot (int r, int s, int num) |
void | removeKnotsBound (const Vector< T > &ub, Vector< T > &ek, T E) |
int | knotInsertion (T u, int r, NurbsCurve< T, N > &nc) |
void | refineKnotVector (const Vector< T > &X) |
void | refineKnotVectorClosed (const Vector< T > &X) |
void | mergeKnotVector (const Vector< T > &Um) |
void | clamp () |
void | unclamp () |
int | leastSquares (const Vector< Point_nD< T, N > > &Q, int degC, int n) |
int | leastSquares (const Vector< Point_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub) |
int | leastSquaresH (const Vector< HPoint_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub) |
int | leastSquares (const Vector< Point_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub, const Vector< T > &knot) |
int | leastSquaresH (const Vector< HPoint_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub, const Vector< T > &knot) |
int | leastSquaresClosed (const Vector< Point_nD< T, N > > &Q, int degC, int n) |
int | leastSquaresClosed (const Vector< Point_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub) |
int | leastSquaresClosedH (const Vector< HPoint_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub) |
int | leastSquaresClosed (const Vector< Point_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub, const Vector< T > &knot) |
int | leastSquaresClosedH (const Vector< HPoint_nD< T, N > > &Q, int degC, int n, const Vector< T > &ub, const Vector< T > &knot) |
void | globalApproxErrBnd (Vector< Point_nD< T, N > > &Q, int deg, T E) |
void | globalApproxErrBnd (Vector< Point_nD< T, N > > &Q, Vector< T > &ub, int deg, T E) |
void | globalApproxErrBnd2 (Vector< Point_nD< T, N > > &Q, int degC, T E) |
void | globalApproxErrBnd3 (Vector< Point_nD< T, N > > &Q, int degC, T E) |
void | globalApproxErrBnd3 (Vector< Point_nD< T, N > > &Q, const Vector< T > &ub, int degC, T E) |
void | globalInterp (const Vector< Point_nD< T, N > > &Q, int d) |
void | globalInterp (const Vector< Point_nD< T, N > > &Q, const Vector< T > &ub, int d) |
void | globalInterpH (const Vector< HPoint_nD< T, N > > &Q, int d) |
void | globalInterpH (const Vector< HPoint_nD< T, N > > &Q, const Vector< T > &U, int d) |
void | globalInterpH (const Vector< HPoint_nD< T, N > > &Q, const Vector< T > &ub, const Vector< T > &U, int d) |
void | globalInterpClosed (const Vector< Point_nD< T, N > > &Qw, int d) |
void | globalInterpClosed (const Vector< Point_nD< T, N > > &Qw, const Vector< T > &ub, int d) |
void | globalInterpClosedH (const Vector< HPoint_nD< T, N > > &Qw, int d) |
void | globalInterpClosedH (const Vector< HPoint_nD< T, N > > &Qw, const Vector< T > &U, int d) |
void | globalInterpClosedH (const Vector< HPoint_nD< T, N > > &Qw, const Vector< T > &ub, const Vector< T > &U, int d) |
void | globalInterpClosed (const Vector< Point_nD< T, N > > &Qw, const Vector< T > &ub, const Vector< T > &Uc, int d) |
void | globalInterpD (const Vector< Point_nD< T, N > > &Q, const Vector< Point_nD< T, N > > &D, int d, int unitD, T a=1.0) |
void | projectTo (const Point_nD< T, N > &p, T guess, T &u, Point_nD< T, N > &r, T e1=0.001, T e2=0.001, int maxTry=100) const |
T | length (T eps=0.001, int n=100) const |
T | lengthIn (T us, T ue, T eps=0.001, int n=100) const |
T | lengthF (T) const |
T | lengthF (T, int) const |
void | makeCircle (const Point_nD< T, N > &O, const Point_nD< T, N > &X, const Point_nD< T, N > &Y, T r, double as, double ae) |
void | makeCircle (const Point_nD< T, N > &O, T r, double as, double ae) |
void | makeCircle (const Point_nD< T, N > &O, T r) |
void | makeLine (const Point_nD< T, N > &P0, const Point_nD< T, N > &P1, int d) |
virtual void | degreeElevate (int t) |
void | decompose (NurbsCurveArray< T, N > &c) const |
void | decomposeClosed (NurbsCurveArray< T, N > &c) const |
int | splitAt (T u, NurbsCurve< T, N > &cl, NurbsCurve< T, N > &cu) const |
int | mergeOf (const NurbsCurve< T, N > &cl, const NurbsCurve< T, N > &cu) |
void | transform (const MatrixRT< T > &A) |
void | modCP (int i, const HPoint_nD< T, N > &a) |
void | modCPby (int i, const HPoint_nD< T, N > &a) |
virtual void | modKnot (const Vector< T > &knotU) |
int | movePoint (T u, const Point_nD< T, N > &delta) |
int | movePoint (T u, const BasicArray< Point_nD< T, N > > &delta) |
int | movePoint (const BasicArray< T > &ur, const BasicArray< Point_nD< T, N > > &D) |
int | movePoint (const BasicArray< T > &ur, const BasicArray< Point_nD< T, N > > &D, const BasicArray_INT &Dr, const BasicArray_INT &Dk) |
int | movePoint (const BasicArray< T > &ur, const BasicArray< Point_nD< T, N > > &D, const BasicArray_INT &Dr, const BasicArray_INT &Dk, const BasicArray_INT &fixCP) |
void | setTangent (T u, const Point_nD< T, N > &T0) |
void | setTangentAtEnd (const Point_nD< T, N > &T0, const Point_nD< T, N > &T1) |
int | read (const char *) |
int | write (const char *) const |
virtual int | read (ifstream &fin) |
int | write (ofstream &fout) const |
int | writePS (const char *, int cp=0, T magFact=T(-1), T dash=T(5), bool bOpen=true) const |
int | writePSp (const char *, const Vector< Point_nD< T, N > > &, const Vector< Point_nD< T, N > > &, int cp=0, T magFact=0.0, T dash=5.0, bool bOpen=true) const |
int | writeVRML (ostream &fout, T radius, int K, const Color &color, int Nu, int Nv, T u_s, T u_e) const |
int | writeVRML (const char *filename, T radius, int K, const Color &color, int Nu, int Nv, T u_s, T u_e) const |
int | writeVRML (const char *filename, T radius=1, int K=5, const Color &color=whiteColor, int Nu=20, int Nv=20) const |
int | writeVRML (ostream &fout, T radius=1, int K=5, const Color &color=whiteColor, int Nu=20, int Nv=20) const |
int | writeVRML97 (const char *filename, T radius, int K, const Color &color, int Nu, int Nv, T u_s, T u_e) const |
int | writeVRML97 (ostream &fout, T radius, int K, const Color &color, int Nu, int Nv, T u_s, T u_e) const |
int | writeVRML97 (const char *filename, T radius=1, int K=5, const Color &color=whiteColor, int Nu=20, int Nv=20) const |
int | writeVRML97 (ostream &fout, T radius=1, int K=5, const Color &color=whiteColor, int Nu=20, int Nv=20) const |
int | writeDisplayLINE (const char *filename, int iNu, const Color &color=blueColor, T fA=1) const |
int | writeDisplayLINE (const char *filename, const Color &color, int iNu, T u_s, T u_e) const |
void | drawImg (Image_UBYTE &Img, unsigned char color=255, T step=0.01) |
void | drawImg (Image_Color &Img, const Color &color, T step=0.01) |
void | drawAaImg (Image_Color &Img, const Color &color, int precision=3, int alpha=1) |
void | drawAaImg (Image_Color &Img, const Color &color, const NurbsCurve< T, 3 > &profile, int precision=3, int alpha=1) |
NurbsSurface< T, 3 > | drawAaImg (Image_Color &Img, const Color &color, const NurbsCurve< T, 3 > &profile, const NurbsCurve< T, 3 > &scaling, int precision=3, int alpha=1) |
BasicList< Point_nD< T, N > > | tesselate (T tolerance, BasicList< T > *uk) const |
Protected Attributes | |
Vector< HPoint_nD< T, N > > | P |
Vector< T > | U |
int | deg_ |
Friends | |
HPoint_nD< T, N > | C (T u, const NurbsCurve< T, N > &nurb) |
Point_nD< T, N > | Cp (T u, const NurbsCurve< T, N > &nurb) |
void | generateCompatibleCurves (NurbsCurveArray< T, N > &ca) |
Related Functions | |
(Note that these are not member functions.) | |
T | chordLengthParam (const Vector< Point_nD< T, N > > &Q, Vector< T > &ub) |
This class is used to represent and manipulate NURBS curve. The curves are composed of points in 4D. They can have any degree and have any number of control points.
Definition at line 58 of file nurbs.h.
|
default constructor.
|
|
A copy constructor.
|
|
Constructor with control points in 4D.
|
|
Constructor with control points in 3D.
|
|
Computes the basis function of the curve.
Computes the i basis function of degree p of the curve at parameter u. The basis function is noted as . The B-spline basis function of $p$-degree is defined as
where the define the knot vector as a nondecreasing sequence of real numbers, i.e., for . And is related to the number of control points $n$ and the degree of the curve $p$ with the relation . The knot vector has the form
Definition at line 840 of file nurbs.cpp. Referenced by removeKnotsBound, and PLib::NurbsCurveSP::updateMaxU. |
|
computes the non-zero basis functions of the curve.
Computes the non-zero basis functions and puts the result into N. N has a size of deg+1. To relate N to the basis functions, Basis[span -deg +i] = N[i] for i=0...deg. The B-spline basis function of -degree is defined as
where the define the knot vector as a nondecreasing sequence of real numbers, {i.e.}, for . And is related to the number of control points $n$ and the degree of the curve with the relation . The knot vector has the form
The B-spline basis function are non-zero for at most of the . The relationship between the non-zero basis functions in N and is as follows, for . Where span is the non-zero span of the basis functions. This non-zero span for u can be found by calling {\tt findSpan(u)}.
Definition at line 1046 of file nurbs.cpp. Referenced by hpointAt, leastSquares, leastSquaresH, and operator(). |
|
Computes the derivative of degree of the curve at parameter u.
For more information on the algorithm used, see A3.2 on p 93 of the NurbsBook.
Definition at line 589 of file nurbs.cpp. References deriveAtH. |
|
Computes the derivative of degree d of the curve at parameter u.
For more information on the algorithm used, see A3.2 on p 93 of the NurbsBook.
Definition at line 566 of file nurbs.cpp. References deriveAt. |
|
Computes the derivative of the curve at the parameter u.
Definition at line 755 of file nurbs.cpp. References deriveAtH. |
|
Computes the derivative at the parameter u.
Implements PLib::ParaCurve. Definition at line 715 of file nurbs.cpp. References deriveAtH. Referenced by derive3D. |
|
Computes the derivative of degree d of the curve at parameter u.
For more information on the algorithm used, see A3.2 on p 93 of the NurbsBook.
Definition at line 644 of file nurbs.cpp. References dersBasisFuns. |
|
Computes the derivative of degree d of the curve at parameter u in the homonegeous domain.
For more information on the algorithm used, see A3.2 on p 93 of the NurbsBook.
Implements PLib::ParaCurve. Definition at line 612 of file nurbs.cpp. References dersBasisFuns, and findSpan. |
|
Compute the derivatives functions at u of the NURBS curve.
For information on the algorithm, see A2.3 on p72 of the NURBS book. The result is stored in the ders matrix, where ders is of size (n+1,deg+1) and the derivative N'_i(u) = ders(1,i=span-deg+j) where j=0...deg+1.
Definition at line 912 of file nurbs.cpp. Referenced by deriveAtH. |
|
Draws an anti-aliased NURBS curve on an image.
This will draw the NURBS by using a brush profile. The drawing is performed by averaging the intensity of the profile at the pixels. This function generates a sweep surface by using the profile given in its argument. The sweep is always performed by following the y-axis of the profile. A scaling function is also used when sweeping. This is used to vary the shape of the profile while it's being swept (see the sweep member function of NurbsSurface<T,N> for more details).
Definition at line 385 of file nurbs.cpp. References PLib::Basic2DArray::cols, PLib::ParaCurve::pointAt, PLib::Basic2DArray::resize, and PLib::Basic2DArray::rows. |
|
draws an anti-aliased NURBS curve on an image.
This will draw the NURBS by using a user-defined brush profile. The drawing is performed by averaging the intensity of the profile at the pixels.
Definition at line 342 of file nurbs.cpp. References drawAaImg. |
|
Draws an anti-aliased NURBS curve on an image.
This will draw the NURBS by using a circular brush profile. The drawing is performed by averaging the intensity of the profile at the pixels.
Definition at line 46 of file d_nurbs.cpp. References C. Referenced by drawAaImg. |
|
Draws a NURBS curve on an image.
This will draw very primitively the NURBS curve on an image. The drawing assumes the line is only in the xy plane (the z is not used for now). The algorithm finds the points on the curve at a step parametric intervall between them and join them by a line. No fancy stuff.
Definition at line 270 of file nurbs.cpp. References PLib::Basic2DArray::cols, PLib::MatrixImage::drawLine, PLib::ParaCurve::pointAt, and PLib::Basic2DArray::rows. |
|
draws a NURBS curve on an image.
This will draw very primitively the NURBS curve on an image. The drawing assumes the line is only in the xy plane (the z is not used for now). The algorithm finds the points on the curve at a step parametric intervall between them and join them by a line. No fancy stuff.
Definition at line 229 of file nurbs.cpp. References PLib::Basic2DArray::cols, PLib::MatrixImage::drawLine, PLib::ParaCurve::pointAt, and PLib::Basic2DArray::rows. |
|
Finds the knot k for which u is in the range [u_k,u_{k+1}).
Definition at line 1118 of file nurbs.cpp. Referenced by findMultSpan. |
|
Finds the multiplicity of a knot.
Definition at line 1139 of file nurbs.cpp. Referenced by findMultSpan. |
|
Finds the multiplicity of a knot at a parametric value.
Finds the index of the knot at parametric value u and returns its multiplicity.
|
|
Determines the knot span index.
Determines the knot span for which their exists non-zero basis functions. The span is the index k for which the parameter u is valid in the [u_k,u_{k+1}] range.
Definition at line 1084 of file nurbs.cpp. Referenced by deriveAtH, leastSquares, leastSquaresH, operator(), and removeKnotsBound. |
|
Get the knot removal error bound for an internal knot.
Get the knot removal error bound for an internal knot r (non-rational). For more information on the algorithm, see A9.8 from the Nurbs book on page 428.
Definition at line 1648 of file nurbs.cpp. Referenced by removeKnotsBound. |
|
Approximation of a curve bounded to a certain error.
It is a type II approximation: it starts with a lot of control points then tries to eliminate as much as it can as long as the curve stays within a certain error bound. The method uses least squares fitting along with knot removal techniques. It is the algorithm A9.10 on p 431 of the NURBS book.
Definition at line 2056 of file nurbs.cpp. References chordLengthParam. |
|
Evaluates the curve in homogenous space at parameter u.
It evaluates the NURBS curve in 4D at the parametric point $u$. Using the following equation where $P_i$ are the control points and $N_{i,p}$ are the $p$th degree B-spline basis functions. For more details on the algorithm, see A4.1 on page 124 of the Nurbs Book.
Implements PLib::ParaCurve. Definition at line 537 of file nurbs.cpp. References basisFuns. |
|
A least squares curve approximation.
This routine solves the following problem: find the NURBS curve satisfying \begin{itemize} \item and \item the remaining are approximated in the least squares sense, {i.e.} \[ \sum_{k=1}^{m-1} | Q_k-C(\bar{u}_k)|^2 \] in a minimum with respect to the variable ; the are the precomputed parameter values. \end{itemize} The resulting curve will generally not pass through and is not the closest point on to . For more details, see section 9.4.1 on page 491 of the NURBS book.
Definition at line 1406 of file nurbs.cpp. References basisFuns, PLib::Basic2DArray::cols, findSpan, PLib::Matrix::get, knot, and PLib::Basic2DArray::rows. |
|
A least squares curve approximation.
This routine solves the following problem: find the NURBS curve satisfying \begin{itemize} \item and \item the remaining are approximated in the least squares sense, {i.e.} \[ \sum_{k=1}^{m-1} | Q_k-C(\bar{u}_k)|^2 \] in a minimum with respect to the variable ; the are the precomputed parameter values. \end{itemize} The resulting curve will generally not pass through and is not the closest point on to . For more details, see section 9.4.1 on page 491 of the NURBS book.
Definition at line 1262 of file nurbs.cpp. References leastSquares. |
|
A least squares curve approximation.
This routine solves the following problem: find the NURBS curve satisfying
For more details, see section 9.4.1 on page 491 of the NURBS book.
Definition at line 1224 of file nurbs.cpp. References chordLengthParam. Referenced by leastSquares. |
|
A least squares curve approximation.
This routine solves the following problem: find the NURBS curve satisfying \begin{itemize} \item and \item the remaining are approximated in the least squares sense, {i.e.} \[ \sum_{k=1}^{m-1} | Q_k-C(\bar{u}_k)|^2 \] in a minimum with respect to the variable ; the are the precomputed parameter values. \end{itemize} The resulting curve will generally not pass through and is not the closest point on to . For more details, see section 9.4.1 on page 491 of the NURBS book.
Definition at line 1535 of file nurbs.cpp. References basisFuns, PLib::Basic2DArray::cols, findSpan, PLib::Matrix::get, knot, and PLib::Basic2DArray::rows. |
|
A least squares curve approximation.
This routine solves the following problem: find the NURBS curve satisfying \begin{itemize} \item and \item the remaining are approximated in the least squares sense, {i.e.} \[ \sum_{k=1}^{m-1} | Q_k-C(\bar{u}_k)|^2 \] in a minimum with respect to the variable ; the are the precomputed parameter values. \end{itemize} The resulting curve will generally not pass through and is not the closest point on to . For more details, see section 9.4.1 on page 491 of the NURBS book.
|
|
Computes the normal of the curve at u from a vector.
Computes the normal of the curve at u from a vector. If the curve lies only in the xy-plane, then calling the function with the vector v = (0,0,1) (the z$axis) will yield a proper normal for this curve.
|
|
Evaluates the curve in 4D at parameter u.
It evaluates the NURBS curve in 4D at the parametric point $u$. Using the following equation where $P_i$ are the control points and $N_{i,p}$ are the $p$th degree B-spline basis functions. For more details on the algorithm, see A4.1 on page 124 of the Nurbs Book.
Implements PLib::ParaCurve. Definition at line 500 of file nurbs.cpp. References basisFuns, and findSpan. Referenced by PLib::NurbsCurve< float, N >::hpointAt. |
|
The assignment operator for a NURBS curve.
Reimplemented in PLib::NurbsCurveSP. |
|
Removes an internal knot from a curve. This is A5.8 on p185 from the NURB book modified to not check for tolerance before removing the knot.
Reimplemented in PLib::NurbsCurveSP. Definition at line 1700 of file nurbs.cpp. References resize. Referenced by removeKnotsBound. |
|
Remove knots from a curve without exceeding an error bound.
For more information about the algorithm, see A9.9 on p429 of the NURB book.
Reimplemented in PLib::NurbsCurveSP. Definition at line 1787 of file nurbs.cpp. References basisFun, findSpan, getRemovalBnd, PLib::Vector< int >::minIndex, PLib::BasicArray< int >::n, removeKnot, PLib::BasicArray< int >::reset, and PLib::BasicArray< int >::resize. |
|
Resets a NURBS curve to new values.
Reimplemented in PLib::NurbsCurveSP. |
|
Resizes a NURBS curve.
Resizes a NURBS curve. The old values are lost and new ones have to be created.
Definition at line 1187 of file nurbs.cpp. Referenced by removeKnot. |
|
Performs geometrical modifications.
Each control points will be modified by a rotation-translation matrix.
|
|
chord length parameterization.
Performs chord length parameterization from a vector of points. The chord length parameterization works as follows: \begin{itemize} \item The total chord length is defined as \item and \item \end{itemize} Where is the size of the vector . \endlatexonly
Definition at line 1971 of file nurbs.cpp. Referenced by globalApproxErrBnd, and leastSquares. |