Main Page   Class Hierarchy   Compound List   File List   Compound Members  

PLib::NurbsSurface Class Template Reference

A class to represent a NURBS surface. More...

#include <nurbsS.hh>

Inheritance diagram for PLib::NurbsSurface::

PLib::ParaSurface PLib::HNurbsSurface PLib::NurbsSurfaceSP PLib::HNurbsSurfaceSP List of all members.

Public Methods

 NurbsSurface ()
 NurbsSurface (const NurbsSurface< T, N > &nS)
 NurbsSurface (int DegU, int DegV, const Vector< T > &Uk, const Vector< T > &Vk, const Matrix< HPoint_nD< T, N > > &Cp)
 NurbsSurface (int DegU, int DegV, Vector< T > &Uk, Vector< T > &Vk, Matrix< Point_nD< T, N > > &Cp, Matrix< T > &W)
virtual ~NurbsSurface ()
const Vector< T > & knotU () const
const Vector< T > & knotV () const
knotU (int i) const
knotV (int i) const
const Matrix< HPoint_nD< T,
N > > & 
ctrlPnts () const
const HPoint_nD< T, N > ctrlPnts (int i, int j) const
int degreeU () const
int degreeV () const
virtual NurbsSurface< T, N > & operator= (const NurbsSurface< T, N > &)
void resize (int Pu, int Pv, int DegU, int DegV)
virtual void resizeKeep (int Pu, int Pv, int DegU, int DegV)
int ok ()
virtual HPoint_nD< T, N > operator() (T u, T v) const
void basisFuns (T u, T v, int spanU, int spanV, Vector< T > &Nu, Vector< T > &Nv) const
void basisFunsU (T u, int span, Vector< T > &N) const
void basisFunsV (T u, int span, Vector< T > &N) const
void dersBasisFuns (T u, T v, int dU, int dV, int uspan, int vspan, Matrix< T > &Niku, Matrix< T > &Njkv) const
void deriveAt (T u, T v, int d, Matrix< Point_nD< T, N > > &skl) const
void deriveAtH (T u, T v, int d, Matrix< HPoint_nD< T, N > > &skl) const
Point_nD< T, N > normal (T u, T v) const
void globalInterp (const Matrix< Point_nD< T, N > > &Q, int pU, int pV)
void globalInterpH (const Matrix< HPoint_nD< T, N > > &Q, int pU, int pV)
void globalInterpClosedU (const Matrix< Point_nD< T, N > > &Q, int pU, int pV)
void globalInterpClosedUH (const Matrix< HPoint_nD< T, N > > &Q, int pU, int pV)
void leastSquares (const Matrix< Point_nD< T, N > > &Q, int pU, int pV, int nU, int nV)
void leastSquaresClosedU (const Matrix< Point_nD< T, N > > &Q, int pU, int pV, int nU, int nV)
int skinV (NurbsCurveArray< T, N > &ca, int degV)
int skinU (NurbsCurveArray< T, N > &ca, int degU)
void sweep (const NurbsCurve< T, N > &t, const NurbsCurve< T, N > &C, const NurbsCurve< T, N > &Sv, int K, int useAy=0, int invAz=0)
void sweep (const NurbsCurve< T, N > &t, const NurbsCurve< T, N > &C, int K, int useAy=0, int invAz=0)
void makeFromRevolution (const NurbsCurve< T, N > &profile, const Point_nD< T, N > &S, const Point_nD< T, N > &T, double theta)
void makeFromRevolution (const NurbsCurve< T, N > &profile, const Point_nD< T, N > &S, const Point_nD< T, N > &T)
void makeFromRevolution (const NurbsCurve< T, N > &profile)
void makeSphere (const Point_nD< T, N > &O, T r)
void makeTorus (const Point_nD< T, N > &O, T R, T r)
void degreeElevate (int tU, int tV)
virtual void degreeElevateU (int tU)
virtual void degreeElevateV (int tV)
int decompose (NurbsSurfaceArray< T, N > &Sa) const
void findSpan (T u, T v, int &spanU, int &spanV) const
int findSpanU (T u) const
int findSpanV (T v) const
int findMultU (int r) const
int findMultV (int r) const
virtual void refineKnots (const Vector< T > &nU, const Vector< T > &nV)
virtual void refineKnotU (const Vector< T > &X)
virtual void refineKnotV (const Vector< T > &X)
virtual void mergeKnots (const Vector< T > &nU, const Vector< T > &nV)
virtual void mergeKnotU (const Vector< T > &X)
virtual void mergeKnotV (const Vector< T > &X)
area (T eps=0.001, int n=100) const
areaIn (T us, T ue, T vs, T ve, T eps, int n) const
areaF (T u, T v) const
void isoCurveU (T u, NurbsCurve< T, N > &c) const
void isoCurveV (T v, NurbsCurve< T, N > &c) const
int read (const char *filename)
int write (const char *filename) const
virtual int read (ifstream &fin)
int write (ofstream &fout) const
int writeVRML (const char *filename, const Color &color, int Nu, int Nv, T u_s, T u_e, T v_s, T v_e) const
int writeVRML (ostream &fout, const Color &color, int Nu, int Nv, T u_s, T u_e, T v_s, T v_e) const
int writeVRML97 (const char *filename, const Color &color, int Nu, int Nv, T u_s, T u_e, T v_s, T v_e) const
int writeVRML97 (ostream &fout, const Color &color, int Nu, int Nv, T u_s, T u_e, T v_s, T v_e) const
ostream & print (ostream &os) const
int writeVRML (const char *filename, const Color &color=whiteColor, int Nu=20, int Nv=20) const
int writeVRML (ostream &fout, const Color &color=whiteColor, int Nu=20, int Nv=20) const
int writeVRML97 (const char *filename, const Color &color=whiteColor, int Nu=20, int Nv=20) const
int writeVRML97 (ostream &fout, const Color &color=whiteColor, int Nu=20, int Nv=20) const
int writePOVRAY (ostream &povray, int patch_type=1, double flatness=0.01, int num_u_steps=8, int num_v_steps=8) const
int writePOVRAY (T, ostream &povray, const Color &color=Color(250, 250, 250), int smooth=0, T ambient=0.2, T diffuse=0.6) const
int writePOVRAY (const char *filename, const Color &color, const Point_nD< T, N > &view, const Point_nD< T, N > &up, int patch_type=1, double flatness=0.01, int num_u_steps=8, int num_v_steps=8) const
int writePOVRAY (T tolerance, const char *filename, const Color &color, const Point_nD< T, N > &view, const Point_nD< T, N > &up, int smooth=0, T ambient=0.2, T diffuse=0.6) const
int writeRIB (ostream &rib) const
int writeRIB (const char *filename, const Color &color, const Point_nD< T, N > &view) const
void tesselate (T tolerance, BasicList< Point_nD< T, N > > &points, BasicList< int > &connect, BasicList< Point_nD< T, N > > *normal=0) const
int writePS (const char *, int nu, int nv, const Point_nD< T, N > &camera, const Point_nD< T, N > &lookAt, int cp=0, T magFact=T(-1), T dash=T(5)) const
int writePSp (const char *, int nu, int nv, const Point_nD< T, N > &camera, const Point_nD< T, N > &lookAt, const Vector< Point_nD< T, N > > &, const Vector< Point_nD< T, N > > &, int cp=0, T magFact=0.0, T dash=5.0) const
int writeOOGL (const char *filename, T fDu, T fDv, T fBu=0.0, T fBv=0.0, T fEu=1.0, T fEv=1.0, bool bDRawCP=false) const
int writeOOGL (const char *filename) const
int writeDisplayQUADMESH (const char *filename, int iNu=100, int iNv=100, const Color &color=blueColor, T fA=.25, T fO=0.2) const
void transform (const MatrixRT< T > &A)
void modCP (int i, int j, const HPoint_nD< T, N > &p)
void modCPby (int i, int j, const HPoint_nD< T, N > &p)
T & modU (int i)
modU (int i) const
T & modV (int i)
modV (int i) const
void modKnotU (const Vector< T > &uKnot)
void modKnotV (const Vector< T > &vKnot)
int movePoint (T u, T v, const Point_nD< T, N > &delta)
int movePoint (const Vector< T > &ur, const Vector< T > &vr, const Vector< Point_nD< T, N > > &D, const Vector_INT &Du, const Vector_INT &Dv)
int movePoint (const Vector< T > &ur, const Vector< T > &vr, const Vector< Point_nD< T, N > > &D, const Vector_INT &Du, const Vector_INT &Dv, const Vector_INT &Dk, const Vector_INT &Dl)
int movePoint (const Vector< T > &ur, const Vector< T > &vr, const Vector< Point_nD< T, N > > &D, const Vector_INT &Du, const Vector_INT &Dv, const Vector_INT &Dk, const Vector_INT &Dl, const BasicArray< Coordinate > &fixCP)
NurbsSurface< T, N > & transpose (void)

Protected Attributes

Vector< T > U
Vector< T > V
Matrix< HPoint_nD< T, N > > P
int degU
int degV

Friends

void gordonSurface (NurbsCurveArray< T, N > &lU, NurbsCurveArray< T, N > &lV, const Matrix< Point_nD< T, N > > &intersections, NurbsSurface< T, N > &gS)
void globalSurfInterpXY (const Matrix< Point_nD< T, N > > &Q, int pU, int pV, NurbsSurface< T, N > &S)
void globalSurfInterpXY (const Matrix< Point_nD< T, N > > &Q, int pU, int pV, NurbsSurface< T, N > &S, const Vector< T > &uk, const Vector< T > &vk)
void globalSurfApprox (const Matrix< Point_nD< T, N > > &Q, int pU, int pV, NurbsSurface< T, N > &S, double error)

Related Functions

(Note that these are not member functions.)

int surfMeshParams (const Matrix< Point_nD< T, N > > &Q, Vector< T > &uk, Vector< T > &vl)
int surfMeshParamsH (const Matrix< HPoint_nD< T, N > > &Q, Vector< T > &uk, Vector< T > &vl)

Detailed Description

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

A class to represent a NURBS surface.

The NURBS surface is composed of points in homogenous space. It can have any degree in both the u and the v direction.

Author:
Philippe Lavoie
Date:
4 Oct. 1996


Constructor & Destructor Documentation

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

Default constructor.

Warning:
The surface is initialized to invalid values. Use a reset or a read function to set them to correct values.
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
PLib::NurbsSurface< T, N >::NurbsSurface const NurbsSurface< T, N > &    s
 

the copy constructor.

Parameters:
s  the NurbsSurface<T,N> to copy
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
PLib::NurbsSurface< T, N >::NurbsSurface int    DegU,
int    DegV,
const Vector< T > &    Uk,
const Vector< T > &    Vk,
const Matrix< HPoint_nD< T, N > > &    Cp
 

constructor with points in homogenous space.

Parameters:
DegU  the degree in the $u$ direction
DegV  the degree in the $v$ direction
Uk  the $u$ knot vector
Vk  the $v$ knot vector
Cp  the matrix of control points in 4D
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
PLib::NurbsSurface< T, N >::NurbsSurface int    DegU,
int    DegV,
Vector< T > &    Uk,
Vector< T > &    Vk,
Matrix< Point_nD< T, N > > &    Cp,
Matrix< T > &    W
 

constructor with points in 3D.

Parameters:
DegU  the degree of the surface in the U direction
DegV  the degree of the surface in the V direction
Uk  the U knot vector
Vk  the V knot vector
Cp  the matrix of 3D control points
W  the weight value for each control points
Author:
Philippe Lavoie
Date:
24 January, 1997


Member Function Documentation

template<class T, int N>
T PLib::NurbsSurface< T, N >::area   eps = 0.001,
int    n = 100
const
 

Computes the area of the surface.

Computes an approximation of the area of the surface using a numerical automatic integrator.

That integrator uses a Chebyshev Series Expansion to perform its approximation. This is why you can change the value n which sets the number of elements in the series.

The method is simple, integrate between each span. This is necessary in case the tangant of a point at u_i is undefined. Add the result and return this as the approximation.

Parameters:
eps  the accepted relative error
n  the number of element in the Chebyshev series
Returns:
the area of the NURBS surface.
Author:
Alejandro Frangi
Date:
20 January 1999

template<class T, int N>
T PLib::NurbsSurface< T, N >::areaF   u,
  v
const
 

area needs to integrate a function over an interval to determine the area of the NURBS surface. Well, this is the function.

Parameters:
u  the parameter
v  the parameter
Returns:
the elemental area at (u,v)
Author:
Alejandro Frangi
Date:
20 January 1999

template<class T, int N>
T PLib::NurbsSurface< T, N >::areaIn   us,
  ue,
  vs,
  ve,
  eps,
int    n
const
 

Computes the area of the surface inside [u_s,u_e].

Computes an approximation of the area of the surface using a numerical automatic integrator. The area is computed for the range [u_s,u_e]

That integrator uses a Chebyshev Series Expansion to perform its approximation. This is why you can change the value n which sets the number of elements in the series.

The method is similar to the one used by area excepted that it needs to check for the range.

Parameters:
us  the starting range
ue  the end of the range
vs  the starting range
ve  the end of the range
n  the number of element in the Chebyshev series
eps  the accepted relative error
Returns:
the area of the NURBS surface.
Warning:
ue (ve) must be greater than us (vs) and both must be in a valid range.
Author:
Alejandro Frangi
Date:
20 January 1999

template<class T, int N>
void PLib::NurbsSurface< T, N >::basisFuns   u,
  v,
int    spanU,
int    spanV,
Vector< T > &    Nu,
Vector< T > &    Nv
const
 

Find the non-zero basis functions in the U and V direction.

Parameters:
u  the u parametric value
v  the v parametric value
spanU  the span of u
spanV  the span of v
Nu  the vector containing the U non-zero basis functions
Nv  the vector containing the V non-zero basis functions
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int nD>
void PLib::NurbsSurface< T, nD >::basisFunsU   u,
int    span,
Vector< T > &    N
const
 

Finds the non-zero basis function in the U direction.

Parameters:
u  the u parametric value
span  the span of u
N  the vector containing the basis functions
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int nD>
void PLib::NurbsSurface< T, nD >::basisFunsV   v,
int    span,
Vector< T > &    N
const
 

Finds the non-zero basis function in the V direction.

Parameters:
v  the v parametric value
span  the span of v
N  the vector containing the basis functions
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::decompose NurbsSurfaceArray< T, N > &    S const
 

Decompose the surface into Bézier patches.

This function decomposes the curve into an array of homogenous Bézier patches.

Parameters:
S  an array of Bézier segments
Returns:
The number of Bézier strips in the u direction.
Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::degreeElevate int    tU,
int    tV
 

Degree elevate the surface in the U and V direction.

Parameters:
tU  elevate the degree of the surface in the u direction by this amount.
tV  elevate the degree of the surface in the v direction by this amount.
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::degreeElevateU int    tU [virtual]
 

Degree elevate the surface in the U direction.

Parameters:
t  elevate the degree in the u direction by this amount.
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::NurbsSurfaceSP, and PLib::NurbsSurfaceSP< float, 3 >.

template<class T, int N>
void PLib::NurbsSurface< T, N >::degreeElevateV int    tV [virtual]
 

Degree elevate the surface in the V direction.

Parameters:
t  elevate the degree in the v direction by this amount.
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::NurbsSurfaceSP, and PLib::NurbsSurfaceSP< float, 3 >.

template<class T, int N>
void PLib::NurbsSurface< T, N >::deriveAt   u,
  v,
int    d,
Matrix< Point_nD< T, N > > &    skl
const [virtual]
 

Computes the point and the derivatives of degree d and below at (u,v).

Computes the matrix of derivatives at u,v . The value of skl(k,l) represents the derivative of the surface S(u,v) with respect to u, k times and to v, l times.

Parameters:
u  the u parametric value
v  the v parametric value
d  the derivative is computed up to and including to this value
skl  the matrix containing the derivatives
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented from PLib::ParaSurface.

template<class T, int nD>
void PLib::NurbsSurface< T, nD >::deriveAtH   u,
  v,
int    d,
Matrix< HPoint_nD< T, nD > > &    skl
const
 

computes the point and the derivatives of degree d and below at (u,v).

Computes the matrix of derivatives at u,v . The value of skl(k,l) represents the derivative of the surface S(u,v) with respect to u k times and to $v$ $l$ times.

Parameters:
u  the u parametric value
v  the v parametric value
d  the derivative is computed up to and including to this value
skl  the matrix containing the derivatives
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::dersBasisFuns   u,
  v,
int    dU,
int    dV,
int    uspan,
int    vspan,
Matrix< T > &    Niku,
Matrix< T > &    Njkv
const
 

Compute the derivatives functions at u,v of the basis functions of the NURBS surface \relates NurbsCurve, nurbsDersBasisFuns.

Parameters:
dU, dV  the degrees of the derivation
u,v  the parametric values
uspan,vspan  the span for the basis functions
Niku  A matrix containing the derivatives of the basis functions in the u direction.
Njku  A matrix containing the derivatives of the basis functions in the v direction.
Warning:
dU,dV, u,v and uspan and vspan must be in a valid range.
Author:
Alejandro Frangi
Date:
15 January 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::findMultU int    r const
 

Finds the multiplicity of a knot in the U knot.

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

template<class T, int N>
int PLib::NurbsSurface< T, N >::findMultV int    r const
 

finds the multiplicity of a knot in the V knot.

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

template<class T, int N>
void PLib::NurbsSurface< T, N >::findSpan   u,
  v,
int &    spanU,
int &    spanV
const
 

finds the span in the U and V direction.

Finds the span in the U and V direction. The spanU is the index k for which the parameter u is valid in the [u_k,u_{k+1}] range. The spanV is the index k for which the parameter v is valid in the [v_k,v_{k+1}] range.

Parameters:
u  find the U span for this parametric value
v  find the V span for this parametric value
spanU  the U span
spanV  the V span
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::findSpanU   u const
 

finds the span in the U direction.

Finds the span in the U direction. The span is the index k for which the parameter u is valid in the [u_k,u_{k+1}] range.

Parameters:
u  --> find the span for this parametric value
Returns:
the span for u
Author:
Philippe Lavoie
Date:
24 January, 1997
\modified 20 January, 1999 (Alejandro Frangi)

template<class T, int N>
int PLib::NurbsSurface< T, N >::findSpanV   v const
 

finds the span in the V direction.

Finds the span in the V direction. The span is the index k for which the parameter v is valid in the [v_k,v_{k+1}] range.

Parameters:
v  find the span for this parametric value
Returns:
the span for v
Author:
Philippe Lavoie
Date:
24 January, 1997 \modified 20 January, 1999 (Alejandro Frangi)

template<class T, int N>
void PLib::NurbsSurface< T, N >::globalInterp const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV
 

Generates a surface using global interpolation.

Parameters:
Q  a matrix of 3D points
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::globalInterpClosedU const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV
 

Generates a closed surface using global interpolation.

Generates a NURBS surface using global interpolation. In the u direction the curve will be closed and with C(pU-1) continuity. Each column in Q indicates the points for a closed curve in the u direction. First and last point have to be equal.

Parameters:
Q  a matrix of 3D points (wrapped in u dir. -rows)
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
Author:
Alejandro Frangi
Date:
30 June, 1998

template<class T, int N>
void PLib::NurbsSurface< T, N >::globalInterpClosedUH const Matrix< HPoint_nD< T, N > > &    Q,
int    pU,
int    pV
 

Generates a surface using global interpolation.

Generates a NURBS surface using global interpolation. In the u direction the curve will be closed and with C(pU-1) continuity. Each column in Q indicates the points for a closed curve in the u direction. First and last point have to be equal.

Parameters:
Q  a matrix of 4D points (wrapped in u dir. -rows)
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
Author:
Alejandro Frangi
Date:
30 June, 1998

template<class T, int N>
void PLib::NurbsSurface< T, N >::globalInterpH const Matrix< HPoint_nD< T, N > > &    Q,
int    pU,
int    pV
 

Generates a surface using global interpolation with homogenous points.

Parameters:
Q  a matrix of 4D points
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int D>
void PLib::NurbsSurface< T, D >::isoCurveU   u,
NurbsCurve< T, D > &    c
const
 

Generates an iso curve in the U direction.

Generates an iso-parametric curve which goes through the parametric value u along the U direction.

Parameters:
u  the U parametric value
c  the iso-parametric curve
Warning:
the parametric value $u$ must be in a valid range
Author:
Philippe Lavoie
Date:
7 October, 1997

template<class T, int D>
void PLib::NurbsSurface< T, D >::isoCurveV   v,
NurbsCurve< T, D > &    c
const
 

Generates an iso curve in the V direction.

Generates an iso-parametric curve which goes through the parametric value v along the V direction.

Parameters:
v  the V parametric value
c  the iso-parametric curve
Warning:
the parametric value $v$ must be in a valid range
Author:
Philippe Lavoie
Date:
7 October, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::leastSquares const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV,
int    nU,
int    nV
 

generates a surface using global least squares approximation.

Parameters:
Q  a matrix of 3D points
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
nU  the number of points in the U direction
nV  the number of poitns in the V direction
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::leastSquaresClosedU const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV,
int    nU,
int    nV
 

Generates a closed surface using global least squares approximation.

Generates a NURBS surface using global least squares approximation. This will be closed in the u direction and open in the v direction. At u=0("="1) the surface will have C(pU-1) continuity in the u direction.

Parameters:
Q  a matrix of 3D points (wrapped in u dir. -rows)
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
nU  the number of points in the U direction
nV  the number of poitns in the V direction
Author:
Alejandro Frangi
Date:
1 August 1998

template<class T, int N>
void PLib::NurbsSurface< T, N >::makeFromRevolution const NurbsCurve< T, N > &    profile
 

Generates a surface of revolution.

Generates a surface of revolution of a profile around the z axis.

Parameters:
profile  the curves to rotate around the z-axis
Author:
Philippe Lavoie
Date:
3 May, 1999

template<class T, int N>
void PLib::NurbsSurface< T, N >::makeFromRevolution const NurbsCurve< T, N > &    profile,
const Point_nD< T, N > &    S,
const Point_nD< T, N > &    Tvec
 

Generates a surface of revolution.

Generates a surface of revolution of a profile around an arbitrary axis (specified by a starting point S and a tangent T).

Parameters:
profile  the curves to rotate around the axis
S  a point on the axis
T  the tangent vector of the rotation axis
Warning:
If a point is within a distance of 1e-7 from the axis, it will be assumed to be on the axis.
Author:
Philippe Lavoie
Date:
3 May, 1999

template<class T, int N>
void PLib::NurbsSurface< T, N >::makeFromRevolution const NurbsCurve< T, N > &    profile,
const Point_nD< T, N > &    S,
const Point_nD< T, N > &    Tvec,
double    theta
 

Generates a surface of revolution.

Generates a surface of revolution of a profile around an arbitrary axis (specified by a starting point S and a tangent T) with a certain angle.

The angle is specified in radians.

Parameters:
profile  the curves to rotate around the axis
S  a point on the axis
T  the tangent vector of the rotation axis
theta  the angle of the revolution (in radians)
Warning:
If a point is within a distance of 1e-7 from the axis, it will be assumed to be on the axis. The angle theta is only valid in the range [0,2 PI].
Author:
Philippe Lavoie
Date:
7 October, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::makeSphere const Point_nD< T, N > &    O,
  r
 

Generates a sphere.

The NURBS surface is now a sphere of radius r located at O.

Parameters:
O  the location of the center of the sphere
r  the radius of the sphere
Author:
Philippe Lavoie
Date:
8 May, 1998

template<class T, int N>
void PLib::NurbsSurface< T, N >::makeTorus const Point_nD< T, N > &    O,
  R,
  r
 

Generates a torus.

The NURBS surface is now a torus with major radius R, minor radius r and located at O. The torus goes around the z-axis. This routine is an adaptation of a routine created by John W. Peterson.

Parameters:
O  the location of the center of the torus
R  the major radius of the torus
r  the minor radius of the torus
Author:
Philippe Lavoie
Date:
4 May, 1999

template<class T, int N>
void PLib::NurbsSurface< T, N >::mergeKnots const Vector< T > &    nU,
const Vector< T > &    nV
[virtual]
 

merges a U and V knot vector with the surface knot vectors.

Parameters:
nU  the U knot vector to merge with
nV  the V knot vector to merge with
Warning:
The nU and nV knot vectors must be compatible with the current vectors
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurfaceSP, and PLib::NurbsSurfaceSP.

template<class T, int N>
void PLib::NurbsSurface< T, N >::mergeKnotU const Vector< T > &    X [virtual]
 

merges the U knot vector with another one.

Parameters:
X  a knot vector
Warning:
The knot vector must be compatible with the U knot vector
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurfaceSP, and PLib::NurbsSurfaceSP.

template<class T, int N>
void PLib::NurbsSurface< T, N >::mergeKnotV const Vector< T > &    X [virtual]
 

merges the V knot vector with another one.

Parameters:
X  a knot vector
Warning:
The knot vector must be compatible with the V knot vector
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurfaceSP, and PLib::NurbsSurfaceSP.

template<class T, int N>
void PLib::NurbsSurface< T, N >::modCP int    i,
int    j,
const HPoint_nD< T, N > &    p
[inline]
 

Parameters:
p  Modifies a control point

template<class T, int N>
void PLib::NurbsSurface< T, N >::modCPby int    i,
int    j,
const HPoint_nD< T, N > &    p
[inline]
 

Parameters:
p  Modifies a control point

template<class T, int N>
int PLib::NurbsSurface< T, N >::movePoint const Vector< T > &    ur,
const Vector< T > &    vr,
const Vector< Point_nD< T, N > > &    D,
const Vector_INT &    Du,
const Vector_INT &    Dv,
const Vector_INT &    Dk,
const Vector_INT &    Dl,
const BasicArray< Coordinate > &    fixCP
 

Moves a point with some constraint.

This will modify the NURBS surface by respecting a certain number of constraints. u_r and v_r specifies the parameters on which the constraints should be applied. The constraint are defined by $D_i^{(k,l)}(u,v)$ which requires 5 vectors to fully qualify. D specifies the value of the constraint and Du and Dv are used to specify on which parameter the constraint is applied and Dk and Dl specify the partial degree of the constraint.

A second constraint fixCP consists of specifying which control points can not be moved by the routine.

The values in D should be ordered in respect with i,k and l. ur and vr should be in an increasing order.

Parameters:
ur  the vector of parameters in the u direction
vr  the vector of parameters in the v direction
D  a vector of the value of D_i^(k,l)(u,v)
Du  a vector specifying the index of the value of u for D_i
Dv  a vector specifying the index of the value of v for D_i
Dk  a vector specifying the value of k for D_i
Dl  a vector specifying the value of l for D_i
fixCP  a vector specifying which control points can not be modified.
Returns:
1 if the operation is possible, 0 if the problem is ill defined i.e. there isn't enough information to find a unique solution (the system is overdetermined) or that the system has non-independant components.
Warning:
The vectors defining $D_i^{(k,l)}(u,v)$ should all be of the same size.
Author:
Philippe Lavoie
Date:
24 January 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::movePoint const Vector< T > &    ur,
const Vector< T > &    vr,
const Vector< Point_nD< T, N > > &    D,
const Vector_INT &    Du,
const Vector_INT &    Dv,
const Vector_INT &    Dk,
const Vector_INT &    Dl
 

Moves a point with some constraint.

This will modify the NURBS surface by respecting a certain number of constraints. u_r and v_r specifies the parameters on which the constraints should be applied. The constraint are defined by D_i^{(k,l)}(u,v) which requires 5 vectors to fully qualify. D specifies the value of the constraint and Du and Dv are used to specify on which parameter the constraint is applied and Dk and Dl specify the partial degree of the constraint.

The values in D should be ordered in respect with i,k and l. ur and vr should be in an increasing order.

Parameters:
ur  the vector of parameters in the u direction
vr  the vector of parameters in the v direction
D  a vector of the value of D_i^(k,l)(u,v)
Du  a vector specifying the index of the value of u for D_i
Dv  a vector specifying the index of the value of v for D_i
Dk  a vector specifying the value of k for D_i
Dl  a vector specifying the value of l for D_i
Returns:
1 if the operation is possible, 0 if the problem is ill defined i.e. there isn't enough information to find a unique solution (the system is overdetermined) or that the system has non-independant components.
Warning:
The vectors defining D_i^{(k,l)}(u,v) should all be of the same size.
Author:
Philippe Lavoie
Date:
24 January 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::movePoint const Vector< T > &    ur,
const Vector< T > &    vr,
const Vector< Point_nD< T, N > > &    D,
const Vector_INT &    Du,
const Vector_INT &    Dv
 

Moves a point with some constraint.

This will modify the NURBS surface by respecting a certain number of constraints. u_r and v_r specifies the parameters on which the constraints should be applied. The constraint are defined by D_i(u,v) which requires 3 vectors to fully qualify. $D$ specifies the value of the constraint and Du and Dv are used to specify on which parameter the constraint is applied.

ur and vr should be in an increasing order.

Parameters:
ur  the vector of parameters in the u direction
vr  the vector of parameters in the v direction
D  a vector of the value of D_i^(k,l)(u,v)
Du  a vector specifying the index of the value of u for D_i
Dv  a vector specifying the index of the value of v for D_i
Returns:
1 if the operation is possible, 0 if the problem is ill defined i.e. there isn't enough information to find a unique solution (the system is overdetermined) or that the system has non-independant components.
Warning:
The vectors defining D_i(u,v) should all be of the same size.
Author:
Philippe Lavoie
Date:
24 January 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::movePoint   u,
  v,
const Point_nD< T, N > &    delta
 

Moves a point on the surface.

This moves the point s(u,v) by delta.

Parameters:
u  the parameter in the u direction
v  the parameter in the v direction
delta  the displacement of the point at S(u,v)
Returns:
1 if the operation is possible, 0 if the problem is ill defined i.e. there isn't enough information to find a unique solution (the system is overdetermined) or that the system has non-independant components.
Author:
Philippe Lavoie
Date:
24 January 1997

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

Computes the normal of the surface at (u,v).

Parameters:
u  the u parametric value
v  the v parametric value
Returns:
the normal at (u,v) .
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::ok  
 

Determines if the surface is valid.

Determines if the surface is valid. The routine only verifies if the number of control points in the U and V direction matches the area of the U and V knot vectors.

Returns:
1 if the surface is valid, 0 otherwise
Author:
Philippe Lavoie
Date:
24 January, 1997

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

Returns the point on the surface at u,v.

Returns the point on the surface at u,v

Parameters:
u  the u parametric value
v  the v parametric value
Returns:
The homogenous point at u,v
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented from PLib::ParaSurface.

Reimplemented in PLib::HNurbsSurface.

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

NurbsSurface<T,N> assignment.

Parameters:
nS  the NURBS surface to copy
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::NurbsSurfaceSP.

template<class T, int N>
ostream & PLib::NurbsSurface< T, N >::print ostream &    o const
 

Sends the NURBS Surface to ostream for display.

Returns:
the ostream
Author:
Philippe Lavoie
Date:
9 November 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::read ifstream &    fin [virtual]
 

Read a surface from an input stream.

Parameters:
fin  the input file stream
Returns:
0 if an error occurs, 1 otherwise
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, PLib::HNurbsSurfaceSP, PLib::NurbsSurfaceGL, PLib::HNurbsSurfaceGL, PLib::NurbsSurfaceSP, PLib::HNurbsSurface< float, N >, PLib::HNurbsSurfaceSP< float, 3 >, and PLib::NurbsSurfaceSP< float, 3 >.

template<class T, int N>
int PLib::NurbsSurface< T, N >::read const char *    f
 

read a surface from a file.

Parameters:
filename  the filename to read from
Returns:
0 if an error occurs, 1 otherwise
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, PLib::HNurbsSurfaceGL, and PLib::HNurbsSurface< float, N >.

template<class T, int N>
void PLib::NurbsSurface< T, N >::refineKnots const Vector< T > &    nU,
const Vector< T > &    nV
[virtual]
 

Refine both knot vectors.

Parameters:
nU  the U knot vector to refine from
nV  the V knot vector to refine from
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, PLib::HNurbsSurfaceSP, and PLib::NurbsSurfaceSP.

template<class T, int N>
void PLib::NurbsSurface< T, N >::refineKnotU const Vector< T > &    X [virtual]
 

Refines the U knot vector.

Parameters:
X  the knot vector to refine from
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, PLib::HNurbsSurfaceSP, and PLib::NurbsSurfaceSP.

template<class T, int N>
void PLib::NurbsSurface< T, N >::refineKnotV const Vector< T > &    X [virtual]
 

Refines the V knot vector.

Parameters:
X  the knot vector to refine from
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, PLib::HNurbsSurfaceSP, and PLib::NurbsSurfaceSP.

template<class T, int N>
void PLib::NurbsSurface< T, N >::resize int    Pu,
int    Pv,
int    DegU,
int    DegV
 

Resize the surface.

Resize the surface. Proper values must be assigned once this function has been called since the resize operator is destructive.

Parameters:
Pu  the number of control points in the U direction
Pv  the number of control points in the V direction
DegU  the degree of the surface in the U direction
DegV  the degree of the surface in the V direction
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::resizeKeep int    Pu,
int    Pv,
int    DegU,
int    DegV
[virtual]
 

Resize the surface while keeping the old values.

Parameters:
Pu  the number of control points in the U direction
Pv  the number of control points in the V direction
DegU  the degree of the surface in the U direction
DegV  the degree of the surface in the V direction
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurfaceSP, PLib::NurbsSurfaceSP, PLib::HNurbsSurfaceSP< float, 3 >, and PLib::NurbsSurfaceSP< float, 3 >.

template<class T, int nD>
int PLib::NurbsSurface< T, nD >::skinU NurbsCurveArray< T, nD > &    ca,
int    dU
 

Generates a NURBS surface from skinning.

The NURBS surface is generates from skinning. The skinning is performed in the U direction.

Parameters:
ca  an array of NURBS curves
degU  the degree to skin in the Udirection
Returns:
0 if an error occurs, 1 otherwise
Warning:
The number of curves to skin from must be greater than degU
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int D>
int PLib::NurbsSurface< T, D >::skinV NurbsCurveArray< T, D > &    ca,
int    dV
 

Generates a NURBS surface from skinning.

The NURBS surface is generated from skinning. The skinning is performed in the V direction.

Parameters:
ca  an array of NURBS curves
degV  the degree to skin in the V direction
surf  the skinned surface
Returns:
0 if an error occurs, 1 otherwise
Warning:
The number of curves to skin from must be greater than degV
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::sweep const NurbsCurve< T, N > &    Trj,
const NurbsCurve< T, N > &    C,
int    K,
int    useAy = 0,
int    invAz = 0
 

Generates a surface by sweeping a curve along a trajectory.

Sweeping consists of creating a surface by moving a curve through a trajectory. The method uses here consists of using skinning of $K$ instances of the curve C(u) along T(u). The K value should be viewed as a minimum.

The cross-sectional curve C(u) should lie on the xz-plane. It follows the trajectory curve T(u) along its y-axis.

You might have to play with the useAy and invAz variables to obtain a satisfactory result for the sweep operation. This is either because there is an error in the code or because it is the way it is supposed to work.

Parameters:
T  the trajectory of the curve
C  the curve to sweep
K  the minimum number of insertion
useAy  a 0 indicates that rotation angle around the y-axis is not computed, otherwise it is computed.
invAz  a 1 indicates that the computed rotation around the z-axis should be inversed, a 0 indicates it stays as it is.
Returns:
the NURBS surface representing the sweep of C along T
Warning:
This will not yield a correct value for a closed trajectory curve.
Author:
Philippe Lavoie
Date:
25 July, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::sweep const NurbsCurve< T, N > &    Trj,
const NurbsCurve< T, N > &    C,
const NurbsCurve< T, N > &    Sv,
int    K,
int    useAy = 0,
int    invAz = 0
 

Generates a surface by sweeping a curve along a trajectory.

Sweeping consists of creating a surface by moving a curve profile through a trajectory. The method uses here consists of using skinning of K instances of the curve C(u) along T(u). The K value should be viewed as the minimum number of sections required.

The profile curve C(u) should lie on the xz-plane. It follows the trajectory curve T(u) along its y-axis.

The scaling function is used to modify the shape of the curve profile while it's being swept. It can scale in any of the 4 dimensions to obtain the desired effects on the profile.

See A10.1 on page 476 of the NURBS book for more details about the implementation.

You might have to play with the useAy and invAz variables to obtain a satisfactory result for the sweep operation. This is either because there is an error in the code or because it is the way it is supposed to work.

Parameters:
T  the trajectory of the curve
C  the curve profile to sweep
Sv  a scaling function
K  the minimum number of insertion
useAy  a 0 indicates that rotation angle around the $y$-axis is not computed, otherwise it is computed. Results are usually better with a value of 0.
invAz  a 1 indicates that the computed rotation around the $z$-axis should be inversed, a 0 indicates it stays as it is.
Returns:
the NURBS surface representing the sweep of $C$ along $T$
Warning:
This will not yield a correct value for a closed trajectory curve.
Author:
Philippe Lavoie
Date:
25 July, 1997

template<class T, int N>
void PLib::NurbsSurface< T, N >::tesselate   tolerance,
BasicList< Point_nD< T, N > > &    points,
BasicList< int > &    connect,
BasicList< Point_nD< T, N > > *    Norm = 0
const
 

Generates a list of triangles for a surface.

This function is deprecated, please use the NurbsSubSurface class which implements everything that this function was suppose to do.

Parameters:
tolerance  the tolerance for the tesselation.
points  the list of points
connect  how the points should be connected
Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
void PLib::NurbsSurface< 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

template<class T, int N>
NurbsSurface< T, N > & PLib::NurbsSurface< T, N >::transpose void   
 

Transpose the U and V coordinates of a surface.

Transpose the U and V coordinates of a surface. After this operation the (u,v) points correspond to (v,u).

Returns:
A reference to itself
Warning:
This is not completely tested
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::write ofstream &    fout const
 

Write a surface to a file stream.

Parameters:
fout  the output filestream to write to.
Returns:
1 on success, 0 on failure
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, PLib::NurbsSurfaceGL, and PLib::HNurbsSurfaceGL.

template<class T, int N>
int PLib::NurbsSurface< T, N >::write const char *    f const
 

Write a surface to a file.

Parameters:
filename  the filename to write to
Returns:
1 on success, 0 on failure
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented in PLib::HNurbsSurface, and PLib::HNurbsSurfaceGL.

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeDisplayQUADMESH const char *    filename,
int    iNu = 100,
int    iNv = 100,
const Color   color = blueColor,
  fA = .25,
  fO = 0.2
const
 

Write the NURBS surface to a mesh file.

This function writes a surface in QUADMESH ascii format to interface with Display (Copyright 1993,1994,1995 David MacDonald, McConnell Brain Imaging Centre), Montreal Neurological Institute, McGill University.

Parameters:
filename  the file name for the output OOGL file
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Alejandro Frangi
Date:
19 May, 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeOOGL const char *    filename const
 

Write the NURBS surface to a OOGL mesh file.

Writes a OOGL bezier file which represents the NURBS surface decomposed into its Bezier patches.

Parameters:
filename  the file name for the output OOGL file
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Alejandro Frangi
Date:
19 May, 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeOOGL const char *    filename,
  fDu,
  fDv,
  fBu = 0.0,
  fBv = 0.0,
  fEu = 1.0,
  fEv = 1.0,
bool    bDrawCP = false
const
 

Write the NURBS surface to a OOGL mesh file.

Writes a OOGL mesh file which represents the surface for the parametric space [fBu,fEu] and [fBv,fEv]. It does not optimize the number of points required to represent the surface.

Parameters:
filename  the file name for the output OOGL file
fDu  the parameter step size in u
fDv  the parameter step size in v
OOGLheader_options  OOGL mesh format header options (evrything before the MESH keyword). If you want the mesh to be closed in the u/v direction you have to give a string containing [u][v] where [] means optional and indicates the direction to be wrapped. See Geomview documentation.
fBu  the initial parameter value in u
fBv  the initial parameter value in v
fEu  the end parameter value in u
fEv  the end parameter value in v
bDrawCP  draws the control points as circles
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Alejandro Frangi
Date:
19 May, 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::writePOVRAY   tolerance,
const char *    filename,
const Color   col,
const Point_nD< T, N > &    cView,
const Point_nD< T, N > &    up,
int    smooth = 0,
  ambient = 0.2,
  diffuse = 0.6
const
 

Writes a set of povray bicubic patches.

Parameters:
tolerance  the tolerance when performing the tesselation
filename  the file to write to
color  the color of the object
diffuse  the diffuse factor
ambient  the ambient factor
smooth  flags which indicates if we generate smooth triangles
Returns:
an ostream containing the definition of the surface
Warning:
POVRAY only accepts rational spline patches. Thus you can't have a value other then 1.0 for the weights of your surface. A warning message will be generated if this is the case.
POVRAY only deals with surfaces of degree 3. If the surface as a degree below 3 either in the U or V direction it will be elevated to be at 3 in both directions. If the surface as a degree higher then 3, then the function aborts.

Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::writePOVRAY const char *    filename,
const Color   col,
const Point_nD< T, N > &    cView,
const Point_nD< T, N > &    up,
int    patch_type = 1,
double    flatness = 0.01,
int    num_u_steps = 8,
int    num_v_steps = 8
const
 

Writes a set of povray bicubic patches.

Parameters:
patch_type  the type of the patch
flatness  the flatness level
num_u_steps  the minimum number of triangles in the U direction
num_v_steps  the minimum number of triangles in the V direction
Returns:
an ostream containing the definition of the surface
Warning:
POVRAY only accepts rational spline patches. Thus you can't have a value other then 1.0 for the weights of your surface. A warning message will be generated if this is the case.
POVRAY only deals with surfaces of degree 3. If the surface as a degree below 3 either in the U or V direction it will be elevated to be at 3 in both directions. If the surface as a degree higher then 3, then the function aborts.

Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::writePOVRAY   tolerance,
ostream &    povray,
const Color   color = Color(250,250,250),
int    smooth = 0,
  ambient = 0.2,
  diffuse = 0.6
const
 

Writes the surface as a mesh of triangles.

Writes the surface as a mesh of triangles. You might have to change the values for the tolerance to get exactly what you're looking for.

Parameters:
povray  the output stream
tolerance  the tolerance when performing the tesselation
color  the color of the object
diffuse  the diffuse factor
ambient  the ambient factor
smooth  flags which indicates if we generate smooth triangles
Returns:
1 on success, 0 on failure
Warning:
It doesn't work very well.
Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::writePOVRAY ostream &    povray,
int    patch_type = 1,
double    flatness = 0.01,
int    num_u_steps = 8,
int    num_v_steps = 8
const
 

Writes a set of povray bicubic patches to the ostream.

Parameters:
patch_type  the type of the patch
flatness  the flatness level
num_u_steps  the minimum number of triangles in the U direction
num_v_steps  the minimum number of triangles in the V direction
povray  the output stream
Returns:
1 on success, 0 on failure.
Warning:
POVRAY only accepts rational spline patches. Thus you can't have a value other then 1.0 for the weights of your surface. A warning message will be generated if this is the case.
POVRAY only deals with surfaces of degree 3. If the surface as a degree below 3 either in the U or V direction it will be elevated to be at 3 in both directions. If the surface as a degree higher then 3, then the function aborts.

Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::writePS const char *    filename,
int    nu,
int    nv,
const Point_nD< T, N > &    camera,
const Point_nD< T, N > &    lookAt,
int    cp = 0,
  magFact = T(-1),
  dash = T(5)
const
 

Writes a post-script file representing the curve.

Parameters:
filename  the file to write the postscript file to
nu  the number of lines in the U direction
nv  the number of lines in the V direction
camera  where the camera is
lookAt  where the camera is looking at
plane  where is the projection plane from the camera
cp  a flag indicating if the control points should be drawn, 0 = no and 1 = yes
magFact  a magnification factor, the 2D point of the control points will be magnified by this value. The size is measured in postscript points. If the magFact is set to a value smaller or equal to 0, than the program will try to guess a magnification factor such that the curve is large enough to fill the page.
dash  the size of the dash in postscript points . A size smaller or equal to 0 indicates that the line joining the control points is plain.
Returns:
0 if an error occurs, 1 otherwise
Warning:
If the weights of the curve are not all at 1, the result might not be representative of the true NURBS curve.
Author:
Philippe Lavoie
Date:
7 October 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::writePSp const char *   ,
int    nu,
int    nv,
const Point_nD< T, N > &    camera,
const Point_nD< T, N > &    lookAt,
const Vector< Point_nD< T, N > > &   ,
const Vector< Point_nD< T, N > > &   ,
int    cp = 0,
  magFact = 0.0,
  dash = 5.0
const
 

writes a post-script file representing the curve.

Writes the curve in the postscript format to a file, it also draws the points defined in points with their associated vectors if vector is used.

Parameters:
filename  the file to write the postscript file to
nu  the number of lines in the U direction
nv  the number of lines in the V direction
camera  where the camera is
lookAt  where the camera is looking at
plane  where is the projection plane from the camera
points  draws these additional points as empty circles
vectors  specify a vector associated with the points (this can be an empty vector)
cp  a flag indicating if the control points should be drawn, 0 = no and 1 = yes
magFact  a magnification factor, the 2D point of the control points will be magnified by this value. The size is measured in postscript points. If the magFact is set to a value smaller or equal to 0, than the program will try to guess a magnification factor such that the curve is large enough to fill the page.
dash  the size of the dash in postscript points . A size smaller or equal to 0 indicates that the line joining the control points is plain.
Returns:
0 if an error occurs, 1 otherwise
Warning:
If the weights of the curve are not all at 1, the result might not be representative of the true NURBS curve. If vectors is used, then it must be of the same size as points. If a vector element is (0,0,0) it will not be drawn.
Author:
Philippe Lavoie
Date:
7 October 1998

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeRIB const char *    filename,
const Color   col,
const Point_nD< T, N > &    view
const
 

Writes a NuPatch for render man.

Writes a file whith follows the RIB protocol of RenderMan. It generates a file which views the whole object. The material used for rendering is plastic.

The RenderMan (R) Interface Procedures and RIB Protocol are: Copyright 1988, 1989, Pixar. All rights reserved. RenderMan (R) is a registered trademark of Pixar.

Parameters:
filename  the file to write to
col  the color of the object
view  the view point
Returns:
0 if an error occurs, 1 otherwise
Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeRIB ostream &    rib const
 

Writes a NuPatch for render man.

Writes a stream which is compatible with Render Man specifications of a NURBS surface.

The RenderMan (R) Interface Procedures and RIB Protocol are: Copyright 1988, 1989, Pixar. All rights reserved. RenderMan (R) is a registered trademark of Pixar.

Parameters:
rib  the rib ostream
Returns:
0 if an error occurs, 1 otherwise
Author:
Philippe Lavoie
Date:
8 October, 1997

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeVRML ostream &    fout,
const Color   color,
int    Nu,
int    Nv,
  u_s,
  u_e,
  v_s,
  v_e
const [inline, virtual]
 

Write the NURBS surface to a VRML file.

Writes a VRML file which represents the surface for the parametric space [uS,uE] and [vS,vE]. It does not optimize the number of points required to represent the surface.

Parameters:
filename  the file name for the output VRML file
Nu  the number of points in the u direction
Nv  the number of points in the v direction
uS  the starting value of u
uE  the end value of u
vS  the starting value of v
vE  the end value of v
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented from PLib::ParaSurface.

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeVRML const char *    filename,
const Color   color,
int    Nu,
int    Nv,
  u_s,
  u_e,
  v_s,
  v_e
const [inline, virtual]
 

Write the NURBS surface to a VRML file.

Writes a VRML file which represents the surface for the parametric space [uS,uE] and [vS,vE]. It does not optimize the number of points required to represent the surface.

Parameters:
filename  the file name for the output VRML file
Nu  the number of points in the u direction
Nv  the number of points in the v direction
uS  the starting value of u
uE  the end value of u
vS  the starting value of v
vE  the end value of v
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Philippe Lavoie
Date:
24 January, 1997

Reimplemented from PLib::ParaSurface.

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeVRML97 ostream &    fout,
const Color   color,
int    Nu,
int    Nv,
  u_s,
  u_e,
  v_s,
  v_e
const [inline, virtual]
 

Write the NURBS surface to a VRML97 file.

Writes a VRML97 file which represents the surface for the parametric space [uS,uE] and [vS,vE]. It does not optimize the number of points required to represent the surface.

Parameters:
filename  the file name for the output VRML file
Nu  the number of points in the u direction
Nv  the number of points in the v direction
uS  the starting value of u
uE  the end value of u
vS  the starting value of v
vE  the end value of v
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Philippe Lavoie
Date:
30 April, 1999

Reimplemented from PLib::ParaSurface.

template<class T, int N>
int PLib::NurbsSurface< T, N >::writeVRML97 const char *    filename,
const Color   color,
int    Nu,
int    Nv,
  u_s,
  u_e,
  v_s,
  v_e
const [inline, virtual]
 

Write the NURBS surface to a VRML file.

Writes a VRML file which represents the surface for the parametric space [uS,uE] and [vS,vE]. It does not optimize the number of points required to represent the surface.

Parameters:
filename  the file name for the output VRML file
Nu  the number of points in the u direction
Nv  the number of points in the v direction
uS  the starting value of u
uE  the end value of u
vS  the starting value of v
vE  the end value of v
Returns:
1 on success, 0 otherwise
Warning:
The parametric surface must be valid
Author:
Philippe Lavoie
Date:
30 April, 1999

Reimplemented from PLib::ParaSurface.


Friends And Related Function Documentation

template<class T, int N>
void globalSurfApprox const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV,
NurbsSurface< T, N > &    S,
double    error = 0
[friend]
 

Generates a surface using global approximation.

Parameters:
Q  a matrix of 3D points
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
S  the interpolated surface
Warning:
This routine is still in a research phase
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void globalSurfInterpXY const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV,
NurbsSurface< T, N > &    S,
const Vector< T > &    uk,
const Vector< T > &    vk
[friend]
 

generates a surface using global interpolation.

Generates a NURBS surface using global interpolation. The data points are assumed to be part of grided points in x-y. i.e. the original data set as points covering the xy plane at regular x and y intervals with only the z being a free variable

Parameters:
Q  a matrix of 3D points
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
S  the interpolated surface
Warning:
Q(0,0) in x-y should be the smallest corner and Q(Q.rows()-1,Q.cols()-1) the biggest.
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void globalSurfInterpXY const Matrix< Point_nD< T, N > > &    Q,
int    pU,
int    pV,
NurbsSurface< T, N > &    S
[friend]
 

Generates a surface using global interpolation.

Generates a NURBS surface using global interpolation. The data points are assumed to be part of grided points in x-y. i.e. the original data set as points covering the xy plane at regular x and y intervals with only the z being a free variable

Parameters:
Q  a matrix of 3D points
pU  the degree of interpolation in the U direction
pV  the degree of interpolation in the V direction
S  the interpolated surface
Warning:
Q(0,0) in x-y should be the smallest corner and Q(Q.rows()-1,Q.cols()-1) the biggest.
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
void gordonSurface NurbsCurveArray< T, N > &    lU,
NurbsCurveArray< T, N > &    lV,
const Matrix< Point_nD< T, N > > &    intersections,
NurbsSurface< T, N > &    gS
[friend]
 

Interpolation of a surface from 2 sets of orthogonal curves.

Interpolation of a surface from 2 sets of orthogonal curves. See A10.3 at page 494 on the NURBS book for more details about the implementation.

Parameters:
lU  an array of curves in the U direction
lV  an array of curves in the V direction
intersections  a matrix of 3D points specifying where the the curves intersect
gS  the Gordon surface
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
int surfMeshParams const Matrix< Point_nD< T, N > > &    Q,
Vector< T > &    uk,
Vector< T > &    vl
[related]
 

Computes the parameters for global surface interpolation.

Computes the parameters for global surface interpolation. For more information, see A9.3 on p377 on the NURBS book.

Parameters:
Q  the matrix of 3D points
uk  the knot coefficients in the U direction
vl  the knot coefficients in the V direction
Returns:
0 if an error occurs, 1 otherwise
Warning:
Author:
Philippe Lavoie
Date:
24 January, 1997

template<class T, int N>
int surfMeshParamsH const Matrix< HPoint_nD< T, N > > &    Q,
Vector< T > &    uk,
Vector< T > &    vl
[related]
 

Computes the parameters for global surface interpolation.

Computes the parameters for global surface interpolation. For more information, see A9.3 on p377 on the NURBS book.

Parameters:
Q  the matrix of 3D points
uk  the knot coefficients in the U direction
vl  the knot coefficients in the V direction
Returns:
0 if an error occurs, 1 otherwise
Author:
Philippe Lavoie
Date:
24 January, 1997


The documentation for this class was generated from the following files:
Generated on Sun Feb 3 00:46:18 2002 for NURBS++ by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001