Main Page   Class Hierarchy   Compound List   File List   Compound Members  

PLib::NurbsCurve Class Template Reference

A NURBS curve class. More...

#include <nurbs.h>

Inheritance diagram for PLib::NurbsCurve:

PLib::ParaCurve PLib::NurbsCurveSP List of all members.

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
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
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
minKnot () const
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
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
length (T eps=0.001, int n=100) const
lengthIn (T us, T ue, T eps=0.001, int n=100) const
lengthF (T) const
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.)

chordLengthParam (const Vector< Point_nD< T, N > > &Q, Vector< T > &ub)

Detailed Description

template<class T, int N>
class PLib::NurbsCurve< T, N >

A NURBS curve class.

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.

Author:
Philippe Lavoie
Date:
4 Oct. 1996

Definition at line 58 of file nurbs.h.


Constructor & Destructor Documentation

template<class T, int N>
PLib::NurbsCurve< T, N >::NurbsCurve  
 

default constructor.

Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 46 of file nurbs.cpp.

template<class T, int N>
PLib::NurbsCurve< T, N >::NurbsCurve const NurbsCurve< T, N > &    nurb
 

A copy constructor.

Parameters:
nurb  the NURBS curve to copy
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 59 of file nurbs.cpp.

template<class T, int N>
PLib::NurbsCurve< T, N >::NurbsCurve const Vector< HPoint_nD< T, N > > &    P1,
const Vector< T > &    U1,
int    Degree = 3
 

Constructor with control points in 4D.

Parameters:
P1  the control points
U1  the knot vector
Degree  the degree of the curve
Warning:
The size of P1,U1 and Degree must agree: P.n()+degree+1=U.n()
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 109 of file nurbs.cpp.

template<class T, int N>
PLib::NurbsCurve< T, N >::NurbsCurve const Vector< Point_nD< T, N > > &    P1,
const Vector< T > &    W,
const Vector< T > &    U1,
int    Degree = 3
 

Constructor with control points in 3D.

Parameters:
P1  --> the control point vector
W  --> the weight for each control points
U1  --> the knot vector
Degree  --> the degree of the curve
Warning:
The size of P1,U1 and Degree must agree: P.n()+degree+1=U.n()
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 138 of file nurbs.cpp.


Member Function Documentation

template<class T, int D>
T PLib::NurbsCurve< T, D >::basisFun   u,
int    i,
int    p = -1
const
 

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

Parameters:
u  the parametric variable
i  specifies which basis function to compute
p  the degree to which the basis function is computed
Returns:
the value of N_{ip}(u)
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 840 of file nurbs.cpp.

Referenced by removeKnotsBound, and PLib::NurbsCurveSP::updateMaxU.

template<class T, int D>
void PLib::NurbsCurve< T, D >::basisFuns   u,
int    i,
Vector< T > &    N
const
 

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)}.

Parameters:
u  the parametric value
i  the non-zero span of the basis functions
N  the non-zero basis functions
Warning:
u and i must be valid values
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 1046 of file nurbs.cpp.

Referenced by hpointAt, leastSquares, leastSquaresH, and operator().

template<class T, int N>
HPoint_nD< T, N > PLib::NurbsCurve< T, N >::derive   u,
int    d
const
 

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.

Parameters:
u  the parametric value to evaluate at
d  the degree of the derivative
Returns:
The derivative d in 4D at the parameter u
Warning:
u and d must be in a valid range.
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 589 of file nurbs.cpp.

References deriveAtH.

template<class T, int N>
Point_nD< T, N > PLib::NurbsCurve< T, N >::derive3D   u,
int    d
const
 

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.

Parameters:
u  the parametric value to evaluate at
d  the degree of the derivative
Returns:
The derivative d in norma space at the parameter u
Warning:
u and d must be in a valid range.
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 566 of file nurbs.cpp.

References deriveAt.

template<class T, int N>
void PLib::NurbsCurve< T, N >::deriveAt   u,
int    d,
int    span,
Vector< Point_nD< T, N > > &    ders
const
 

Computes the derivative of the curve at the parameter u.

Parameters:
u  the parameter at which the derivative is computed
d  the degree of derivation
span  the span of u.
ders  the vector containing the derivatives of the point at u.
Warning:
u and $d$ must be in a valid range.
Author:
Philippe Lavoie
Date:
9 October 1998

Definition at line 755 of file nurbs.cpp.

References deriveAtH.

template<class T, int N>
void PLib::NurbsCurve< T, N >::deriveAt   u,
int    d,
Vector< Point_nD< T, N > > &    ders
const [virtual]
 

Computes the derivative at the parameter u.

Parameters:
u  the parameter at which the derivative is computed
d  the degree of derivation
ders  the vector containing the derivatives of the point at u.
\wanring u and d must be in a valid range.
Author:
Philippe Lavoie
Date:
24 January, 1997

Implements PLib::ParaCurve.

Definition at line 715 of file nurbs.cpp.

References deriveAtH.

Referenced by derive3D.

template<class T, int N>
void PLib::NurbsCurve< T, N >::deriveAtH   u,
int    d,
int    span,
Vector< HPoint_nD< T, N > > &    ders
const
 

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.

Parameters:
u  the parametric value to evaluate at
d  the degree of the derivative
span  the span of u
ders  a vector containing the derivatives of the curve at u.
Warning:
u and d must be in a valid range.
Author:
Philippe Lavoie
Date:
9 October, 1998

Definition at line 644 of file nurbs.cpp.

References dersBasisFuns.

template<class T, int N>
void PLib::NurbsCurve< T, N >::deriveAtH   u,
int    d,
Vector< HPoint_nD< T, N > > &    ders
const [virtual]
 

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.

Parameters:
u  the parametric value to evaluate at
d  the degree of the derivative
ders  a vector containing the derivatives of the curve at u.
Warning:
u and d must be in a valid range.
Author:
Philippe Lavoie
Date:
24 January, 1997

Implements PLib::ParaCurve.

Definition at line 612 of file nurbs.cpp.

References dersBasisFuns, and findSpan.

Referenced by derive, and deriveAt.

template<class T, int N>
void PLib::NurbsCurve< T, N >::dersBasisFuns int    n,
  u,
int    span,
Matrix< T > &    ders
const
 

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.

Parameters:
n  the degree of the derivation
u  the parametric value
span  the span for the basis functions
ders  A matrix containing the derivatives of the curve.
Warning:
n, u and span must be valid values.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 912 of file nurbs.cpp.

Referenced by deriveAtH.

template<class T, int N>
NurbsSurface< T, 3 > PLib::NurbsCurve< T, N >::drawAaImg Image_Color &    Img,
const Color   color,
const NurbsCurve< T, 3 > &    profile,
const NurbsCurve< T, 3 > &    scaling,
int    precision = 3,
int    alpha = 1
 

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).

Parameters:
Img  draws the nurbs curve to this Image
color  the line is drawn in this color
profile  the profile of the NURBS curve to draw
scaling  the scaling to give the profile while drawing the curve
precision  this number influences the number of points used for averaging purposes.
alpha  a flag indicating if the profile is used as an alpha chanel. If so, the line doesn't overwrite, it blends the line with the image already present in Img.
Warning:
This routine is very slow; use normal drawing for speed or lower the precision factor.
Author:
Philippe Lavoie
Date:
25 July 1997

Definition at line 385 of file nurbs.cpp.

References PLib::Basic2DArray::cols, PLib::ParaCurve::pointAt, PLib::Basic2DArray::resize, and PLib::Basic2DArray::rows.

template<class T, int N>
void PLib::NurbsCurve< T, N >::drawAaImg Image_Color &    Img,
const Color   color,
const NurbsCurve< T, 3 > &    profile,
int    precision = 3,
int    alpha = 1
 

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.

Parameters:
Img  draws the nurbs curve to this Image
color  the line is drawn in this color
profile  the profile of the NURBS curve to draw
precision  this number influences the number of points used for averaging purposes.
alpha  a flag indicating if the profile is used as an alpha chanel. If so, the line doesn't overwrite, it blends the line with the image already present in Img.
Warning:
This routine is very slow; use normal drawing for speed.
Author:
Philippe Lavoie
Date:
22 August 1997

Definition at line 342 of file nurbs.cpp.

References drawAaImg.

template<class T, int N>
void PLib::NurbsCurve< T, N >::drawAaImg Image_Color &    Img,
const Color   color,
int    precision = 3,
int    alpha = 1
 

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.

Parameters:
Img  draws the nurbs curve to this Image
color  the line is drawn in this color
precision  this number influences the number of points used for averaging purposes.
alpha  a flag indicating if the profile is used as an alpha chanel. If so, the line doesn't overwrite, it blends the line with the image already present in Img.
Warning:
This routine is very slow; use normal drawing for speed.
Author:
Philippe Lavoie
Date:
25 July 1997

Definition at line 46 of file d_nurbs.cpp.

References C.

Referenced by drawAaImg.

template<class T, int N>
void PLib::NurbsCurve< T, N >::drawImg Image_Color &    Img,
const Color   color,
  step = 0.01
 

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.

Parameters:
Img  draws the nurbs curve to this Image
color  the line is drawn in this color
step  the parametric distance between two computed points.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 270 of file nurbs.cpp.

References PLib::Basic2DArray::cols, PLib::MatrixImage::drawLine, PLib::ParaCurve::pointAt, and PLib::Basic2DArray::rows.

template<class T, int N>
void PLib::NurbsCurve< T, N >::drawImg Image_UBYTE &    Img,
unsigned char    color = 255,
  step = 0.01
 

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.

Parameters:
Img  <-- draws the nurbs curve to this Image
color  --> the line is drawn in this color
step  --> the parametric distance between two computed points.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 229 of file nurbs.cpp.

References PLib::Basic2DArray::cols, PLib::MatrixImage::drawLine, PLib::ParaCurve::pointAt, and PLib::Basic2DArray::rows.

template<class T, int N>
int PLib::NurbsCurve< T, N >::findKnot   u const
 

Finds the knot k for which u is in the range [u_k,u_{k+1}).

Parameters:
u  parametric value
Returns:
the index k
Warning:
u must be in a valid range.
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 1118 of file nurbs.cpp.

Referenced by findMultSpan.

template<class T, int N>
int PLib::NurbsCurve< T, N >::findMult int    r const
 

Finds the multiplicity of a knot.

Parameters:
r  the knot to observe
Returns:
the multiplicity of the knot
Warning:
r must be a valid knot index
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 1139 of file nurbs.cpp.

Referenced by findMultSpan.

template<class T, int N>
void PLib::NurbsCurve< T, N >::findMultSpan   u,
int &    r,
int &    s
const
 

Finds the multiplicity of a knot at a parametric value.

Finds the index of the knot at parametric value u and returns its multiplicity.

Parameters:
u  the parametric value
r  the knot of interest
s  the multiplicity of this knot
Warning:
u must be in a valid range.
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 1165 of file nurbs.cpp.

References findKnot, and findMult.

template<class T, int N>
int PLib::NurbsCurve< T, N >::findSpan   u const
 

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.

Parameters:
u  the parametric value
Returns:
the span index at u.
Warning:
u must be in a valid range
Author:
Philippe Lavoie
Date:
24 January 1997 \modified 20 January, 1999 (Alejandro Frangi)

Definition at line 1084 of file nurbs.cpp.

Referenced by deriveAtH, leastSquares, leastSquaresH, operator(), and removeKnotsBound.

template<class T, int N>
T PLib::NurbsCurve< T, N >::getRemovalBnd int    r,
int    s
const
 

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.

Parameters:
curve  a NURBS curve
r  the index of the internal knot to check
s  the multiplicity of that knot
Returns:
The maximum distance between the new curve and the old one
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 1648 of file nurbs.cpp.

Referenced by removeKnotsBound.

template<class T, int N>
void PLib::NurbsCurve< T, N >::globalApproxErrBnd Vector< Point_nD< T, N > > &    Q,
int    degC,
  E
 

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.

Parameters:
Q  the points to approximate
degree  the degree of the approximation curve
E  the maximum error allowed
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 2056 of file nurbs.cpp.

References chordLengthParam.

template<class T, int N>
HPoint_nD< T, N > PLib::NurbsCurve< T, N >::hpointAt   u,
int    span
const [virtual]
 

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.

Parameters:
u  the parametric value at which the curve is evaluated
span  the span of u
Returns:
the 4D point at C(u)
Warning:
the parametric value must be in a valid range
Author:
Philippe Lavoie
Date:
24 January, 1997

Implements PLib::ParaCurve.

Definition at line 537 of file nurbs.cpp.

References basisFuns.

template<class T, int D>
int PLib::NurbsCurve< T, D >::leastSquares const Vector< Point_nD< T, D > > &    Q,
int    degC,
int    n,
const Vector< T > &    ub,
const Vector< T > &    knot
 

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.

Parameters:
Q  the vector of 3D points
degC  the degree of the curve
n  the number of control points in the new curve
ub  the knot coefficients
knot  the knot vector to use for the curve
Returns:
1 if succesfull, 0 it the number of points to approximate the curve with is too big compared to the number of points.
Warning:
the variable curve must contain a valid knot vector.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 1406 of file nurbs.cpp.

References basisFuns, PLib::Basic2DArray::cols, findSpan, PLib::Matrix::get, knot, and PLib::Basic2DArray::rows.

template<class T, int N>
int PLib::NurbsCurve< T, N >::leastSquares const Vector< Point_nD< T, N > > &    Q,
int    degC,
int    n,
const Vector< T > &    ub
 

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.

Parameters:
Q  the vector of 3D points
degC  the degree of the curve
n  the number of control points in the new curve
ub  the knot coefficients
Warning:
the variable curve must contain a valid knot vector.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 1262 of file nurbs.cpp.

References leastSquares.

template<class T, int N>
int PLib::NurbsCurve< T, N >::leastSquares const Vector< Point_nD< T, N > > &    Q,
int    degC,
int    n
 

A least squares curve approximation.

This routine solves the following problem: find the NURBS curve satisfying

  • 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 parameter values computed with the chord length method.
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.

Parameters:
Q  the vector of 3D points
degC  the degree of the curve
n  the number of control points in the new curve.
Warning:
deg must be smaller than Q.n().
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 1224 of file nurbs.cpp.

References chordLengthParam.

Referenced by leastSquares.

template<class T, int D>
int PLib::NurbsCurve< T, D >::leastSquaresH const Vector< HPoint_nD< T, D > > &    Q,
int    degC,
int    n,
const Vector< T > &    ub,
const Vector< T > &    knot
 

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.

Parameters:
Q  the vector of 4D points
degC  the degree of the curve
n  the number of control points in the new curve
ub  the knot coefficients
knot  the knot vector to use for the curve
Returns:
1 if succesfull, 0 it the number of points to approximate the curve with is too big compared to the number of points.
Warning:
the variable curve must contain a valid knot vector.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 1535 of file nurbs.cpp.

References basisFuns, PLib::Basic2DArray::cols, findSpan, PLib::Matrix::get, knot, and PLib::Basic2DArray::rows.

template<class T, int N>
int PLib::NurbsCurve< T, N >::leastSquaresH const Vector< HPoint_nD< T, N > > &    Q,
int    degC,
int    n,
const Vector< T > &    ub
 

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.

Parameters:
Q  the vector of 4D points
degC  the degree of the curve
n  the number of control points in the new curve
ub  the knot coefficients
Warning:
the variable curve must contain a valid knot vector.
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 1333 of file nurbs.cpp.

template<class T, int N>
Point_nD< T, N > PLib::NurbsCurve< T, N >::normal   u,
const Point_nD< T, N > &    v
const
 

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.

Parameters:
u  the parameter at which the normal is computed
v  the vector to compute the normal with
Returns:
the normal vector in 3D.
Warning:
u must be in a valid range.
Author:
Philippe Lavoie
Date:
2 September, 1997

Definition at line 799 of file nurbs.cpp.

template<class T, int N>
HPoint_nD< T, N > PLib::NurbsCurve< T, N >::operator()   u const [virtual]
 

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.

Parameters:
u  the parametric value at which the curve is evaluated
Returns:
the 4D point at C(u)
Warning:
the parametric value must be in a valid range
Author:
Philippe Lavoie
Date:
24 January, 1997

Implements PLib::ParaCurve.

Definition at line 500 of file nurbs.cpp.

References basisFuns, and findSpan.

Referenced by PLib::NurbsCurve< float, N >::hpointAt.

template<class T, int N>
NurbsCurve< T, N > & PLib::NurbsCurve< T, N >::operator= const NurbsCurve< T, N > &    curve [virtual]
 

The assignment operator for a NURBS curve.

Parameters:
curve  the NURBS curve to copy
Returns:
A reference to itself
Warning:
The curve being copied must be valid, otherwise strange results might occur.
Author:
Philippe Lavoie
Date:
24 January 1997

Reimplemented in PLib::NurbsCurveSP.

Definition at line 184 of file nurbs.cpp.

template<class T, int N>
void PLib::NurbsCurve< T, N >::removeKnot int    r,
int    s,
int    num
 

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.

Parameters:
r  the knot to remove
s  the multiplicity of the knot
num  the number of times to try to remove the knot
Warning:
r must be an internal knot.
Author:
Philippe Lavoie
Date:
24 January 1997

Reimplemented in PLib::NurbsCurveSP.

Definition at line 1700 of file nurbs.cpp.

References resize.

Referenced by removeKnotsBound.

template<class T, int N>
void PLib::NurbsCurve< T, N >::removeKnotsBound const Vector< T > &    ub,
Vector< T > &    ek,
  E
 

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.

Parameters:
ub  the knot coefficients
ek  the error after removing
Author:
Philippe Lavoie
Date:
24 January 1997

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.

template<class T, int N>
void PLib::NurbsCurve< T, N >::reset const Vector< HPoint_nD< T, N > > &    P1,
const Vector< T > &    U1,
int    Degree
[virtual]
 

Resets a NURBS curve to new values.

Parameters:
P1  the new values for the control points
U1  the new values for the knot vector
Degree  the new degree of the curve
Warning:
The size of P1,U1 and Degree must agree: P.n()+degree+1=U.n()
Author:
Philippe Lavoie
Date:
24 January 1997

Reimplemented in PLib::NurbsCurveSP.

Definition at line 76 of file nurbs.cpp.

template<class T, int N>
void PLib::NurbsCurve< T, N >::resize int    n,
int    Deg
 

Resizes a NURBS curve.

Resizes a NURBS curve. The old values are lost and new ones have to be created.

Parameters:
n  the new number of control points for the curve
Deg  the new degree for the curve
Author:
Philippe Lavoie
Date:
24 January 1997

Definition at line 1187 of file nurbs.cpp.

Referenced by removeKnot.

template<class T, int N>
void PLib::NurbsCurve< T, N >::transform const MatrixRT< T > &    A
 

Performs geometrical modifications.

Each control points will be modified by a rotation-translation matrix.

Parameters:
A  the rotation-translation matrix
Author:
Philippe Lavoie
Date:
22 August 1997

Definition at line 471 of file nurbs.cpp.


Friends And Related Function Documentation

template<class T, int N>
T chordLengthParam const Vector< Point_nD< T, N > > &    Q,
Vector< T > &    ub
[related]
 

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

Parameters:
Q  a vector of 3D points
ub  the result of chord length parameterization
Returns:
the total chord length of the points.
Author:
Philippe Lavoie
Date:
24 January, 1997

Definition at line 1971 of file nurbs.cpp.

Referenced by globalApproxErrBnd, and leastSquares.


The documentation for this class was generated from the following files:
Generated on Tue Jun 24 13:27:00 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002