Main Page   Class Hierarchy   Compound List   File List   Compound Members  

PLib::HNurbsSurface Class Template Reference

A hierarchichal NURBS surface class. More...

#include <hnurbsS.h>

Inheritance diagram for PLib::HNurbsSurface:

PLib::NurbsSurface PLib::ParaSurface PLib::HNurbsSurfaceSP List of all members.

Public Methods

 HNurbsSurface ()
 HNurbsSurface (const NurbsSurface< T, N > &S)
 HNurbsSurface (const HNurbsSurface< T, N > &S)
 HNurbsSurface (HNurbsSurface< T, N > *base)
 HNurbsSurface (HNurbsSurface< T, N > *base, const Vector< T > &xU, const Vector< T > &xV)
 HNurbsSurface (HNurbsSurface< T, N > *base, const HNurbsSurface< T, N > &surf)
virtual ~HNurbsSurface ()
HNurbsSurface< T, N > * baseLevel () const
HNurbsSurface< T, N > * nextLevel () const
HNurbsSurface< T, N > * firstLevel () const
HNurbsSurface< T, N > * lastLevel () const
void splitUV (int nu, int nv, Vector< T > &nU, Vector< T > &nV)
void splitUV (int nu, int su, int nv, int sv, Vector< T > &nU, Vector< T > &nV)
virtual HNurbsSurface< T,
N > * 
addLevel (int nsplit)
virtual HNurbsSurface< T,
N > * 
addLevel ()
virtual void copy (const HNurbsSurface< T, N > &nS)
int modifies (T u, T v)
HPoint_nD< T, N > operator() (T u, T v) const
HPoint_nD< T, N > hpointAt (T u, T v, int lod=-1) const
void deriveAtH (T u, T v, int, Matrix< HPoint_nD< T, N > > &, int lod=-1) const
void deriveAt (T u, T v, int, Matrix< Point_nD< T, N > > &, int lod=-1) const
int movePointOffset (T u, T v, const Point_nD< T, N > &delta)
void scale (const Point_nD< T, N > &s)
int initBase (int force=0)
virtual void updateSurface (int i0=-1, int j0=-1)
virtual void updateLevels (int updateLevel=-1)
int isoCurveU (T u, NurbsCurve< T, N > &c, int lod=-1) const
int isoCurveV (T v, NurbsCurve< T, N > &c, int lod=-1) const
int read (const char *filename)
int write (const char *filename) const
virtual int read (ifstream &fin)
int write (ofstream &fout) const
int level () const
int maxLevel () const
int modifiedN () const
void refineKnots (const Vector< T > &nU, const Vector< T > &nV)
void refineKnotU (const Vector< T > &X)
void refineKnotV (const Vector< T > &X)
void axis (int i, int j, Point_nD< T, N > &xaxis, Point_nD< T, N > &yaxis, Point_nD< T, N > &zaxis) const
void setFixedOffsetVector (const Point_nD< T, N > &I, const Point_nD< T, N > &J, const Point_nD< T, N > &K)
void setVariableOffsetVector ()

Public Attributes

Matrix< HPoint_nD< T, N > > offset
Vector< T > rU
Vector< T > rV

Protected Attributes

NurbsSurface< T, N > baseSurf
HNurbsSurface< T, N > * baseLevel_
HNurbsSurface< T, N > * nextLevel_
HNurbsSurface< T, N > * firstLevel_
HNurbsSurface< T, N > * lastLevel_
Matrix< Point_nD< T, N > > ivec
Matrix< Point_nD< T, N > > jvec
Matrix< Point_nD< T, N > > kvec
int level_
int updateN
int baseUpdateN
int update_
uS_
uE_
vS_
vE_
uD
vD
int fixedOffset

Detailed Description

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

A hierarchichal NURBS surface class.

This class can represent and manipulate a hierarchical NURBS surface. The surface is composed of points in homogenous space. It can have any degree and have any number of control points.

This does not correspond to the HBsplines given by Forsey. However I hope that it will be usefull for interactive manipulations of NURBS surfaces.

Other aspects of my implementation are different. They will be documented when the class is fully functionnal.

Presently there is only a limited set of functions available for this class. And honestly, until I can optimize the space requirement of the class I don't think you should build anything critical with a HNurbsSurface.

Author:
Philippe Lavoie
Date:
28 September 1997

Definition at line 60 of file hnurbsS.h.


Constructor & Destructor Documentation

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

The basic constructor.

Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 39 of file hnurbsS.cpp.

Referenced by addLevel, and copy.

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

Constructs a base HNURBS.

Constructs a base HNURBS. This HNURBS surface is set to level 0. And it corresponds to the NURBS surface.

This constructor does not transform the NURBS surface into a HNURBS surface. It only copies the values from the NURBS surface as it's base offset values.

Parameters:
S  the NURBS surface at level 0
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 190 of file hnurbsS.cpp.

References PLib::NurbsSurface::P.

template<class T, int N>
PLib::HNurbsSurface< T, N >::HNurbsSurface const HNurbsSurface< T, N > &    S
 

The copy constructor.

Parameters:
S  the HNURBS surface to copy
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 215 of file hnurbsS.cpp.

References copy.

template<class T, int N>
PLib::HNurbsSurface< T, N >::HNurbsSurface HNurbsSurface< T, N > *    base
 

Constructor with a base level.

Parameters:
base  the base level
xU  the U knots to insert in this level
xV  the V knots to insert in this level
Warning:
The base pointer must be pointing to a valid object
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 129 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, initBase, PLib::NurbsSurface::P, PLib::NurbsSurface::U, and PLib::NurbsSurface::V.

template<class T, int N>
PLib::HNurbsSurface< T, N >::HNurbsSurface HNurbsSurface< T, N > *    base,
const Vector< T > &    xU,
const Vector< T > &    xV
 

Constructor with a base level.

Parameters:
base  the base level
xU  the U knots to insert in this level
xV  the V knots to insert in this level
Warning:
The base pointer must be pointing to a valid object
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 66 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, initBase, PLib::NurbsSurface::P, PLib::NurbsSurface::U, and PLib::NurbsSurface::V.

template<class T, int N>
PLib::HNurbsSurface< T, N >::HNurbsSurface HNurbsSurface< T, N > *    base,
const HNurbsSurface< T, N > &    surf
 

A level constructor.

Parameters:
base  the base of this level
the  values for this new level
Warning:
The base pointer must be pointing to a valid object
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 245 of file hnurbsS.cpp.

References copy, and initBase.

template<class T, int N>
PLib::HNurbsSurface< T, N >::~HNurbsSurface   [virtual]
 

Destructor.

Deletes all the levels.

Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 685 of file hnurbsS.cpp.


Member Function Documentation

template<class T, int N>
HNurbsSurface< T, N > * PLib::HNurbsSurface< T, N >::addLevel   [virtual]
 

Adds a level to this HNURBS surface.

Parameters:
n  the number of new knots between each knots.
Returns:
a pointer to the new level or 0 if there was an error.
Warning:
returns 0, if there is already a nextlevel.
Author:
Philippe Lavoie
Date:
7 October 1997

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 897 of file hnurbsS.cpp.

References HNurbsSurface.

Referenced by read.

template<class T, int N>
HNurbsSurface< T, N > * PLib::HNurbsSurface< T, N >::addLevel int    n [virtual]
 

Adds a level to this HNURBS surface.

Parameters:
n  the number of new knots between each knots.
Returns:
a pointer to the new level or 0 if there was an error.
Warning:
returns 0, if there is already a nextlevel.
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 869 of file hnurbsS.cpp.

References HNurbsSurface, and splitUV.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::copy const HNurbsSurface< T, N > &    nS [virtual]
 

Copies a HNurbs Surface and all it children.

Parameters:
ns  the HNurbs surface to copy
Author:
Philippe Lavoie
Date:
7 October 1997

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 292 of file hnurbsS.cpp.

References HNurbsSurface.

Referenced by HNurbsSurface.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::deriveAt   u,
  v,
int    d,
Matrix< Point_nD< T, N > > &    ders,
int    lod = -1
const
 

Finds the derivative of the point (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
ders  the Matrix of derivatives.
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 662 of file hnurbsS.cpp.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::deriveAtH   u,
  v,
int    d,
Matrix< HPoint_nD< T, N > > &    ders,
int    lod = -1
const
 

Finds the derivative of the point (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
ders  the Matrix of derivatives.
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 632 of file hnurbsS.cpp.

template<class T, int N>
HPoint_nD< T, N > PLib::HNurbsSurface< T, N >::hpointAt   u,
  v,
int    lod = -1
const
 

finds the homogenous point at (u,v) for a certain level of detail.

Parameters:
u  the u parametric value
v  the v parametric value
lod  the level of detail3
Returns:
the homogenous point at (u,v) and at the level of detail specivied by lod.
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 588 of file hnurbsS.cpp.

Referenced by PLib::HNurbsSurface< float, N >::operator().

template<class T, int N>
int PLib::HNurbsSurface< T, N >::initBase int    force = 0
 

Initialize the base surface.

Initialize the base surface from the previous level if it has been modified.

Parameters:
force  if set, this forces an update of the base surface
Returns:
1 if the base surface is modified, 0 otherwise.
Author:
Philippe Lavoie
Date:
15 April 1998

Definition at line 411 of file hnurbsS.cpp.

Referenced by HNurbsSurface, refineKnots, setFixedOffsetVector, setVariableOffsetVector, PLib::HNurbsSurfaceSP::updateSurface, and updateSurface.

template<class T, int N>
int PLib::HNurbsSurface< T, N >::isoCurveU   u,
NurbsCurve< T, N > &    c,
int    lod = -1
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
lod  the level of detail to draw the curve with
Returns:
0 if an error occured, 1 otherwise.
Warning:
the parametric value u must be in a valid range
Author:
Philippe Lavoie
Date:
7 October, 1997

Definition at line 926 of file hnurbsS.cpp.

template<class T, int N>
int PLib::HNurbsSurface< T, N >::isoCurveV   v,
NurbsCurve< T, N > &    c,
int    lod = -1
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
lod  the level of detail to draw the curve with
Returns:
0 if an error occured, 1 otherwise
Warning:
the parametric value v must be in a valid range
Author:
Philippe Lavoie
Date:
7 October, 1997

Definition at line 959 of file hnurbsS.cpp.

template<class T, int N>
int PLib::HNurbsSurface< T, N >::maxLevel   const
 

the maximum level of detail.

Finds the maximum level of detail available from this HNURBS surface

Returns:
the maximum level of detail.
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 610 of file hnurbsS.cpp.

template<class T, int N>
int PLib::HNurbsSurface< T, N >::modifies   u,
  v
 

Specifies the level that modifies the point.

Specifies what level modifies the point (u,v)

Parameters:
u  the u parametric value
v  the v parametric value
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 550 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, PLib::NurbsSurface::findSpanU, PLib::NurbsSurface::findSpanV, PLib::NurbsSurface::knotU, and PLib::NurbsSurface::knotV.

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

Move a point on the surface.

This moves the point s(u,v) by delta. As this is a HNURBS surface. It moves the offset surface by delta, it doesn't move the surface point per say.

Parameters:
u  the parameter in the u direction
v  the parameter in the v direction
delta  the displacement of the point s(u,v)
Returns:
1 if the operation was succesfull, 0 otherwise
Warning:
u and v must be in a valid range.
Author:
Philippe Lavoie
Date:
3 June 1998

Definition at line 1372 of file hnurbsS.cpp.

References PLib::NurbsSurface::P, and updateSurface.

template<class T, int N>
HPoint_nD<T,N> PLib::HNurbsSurface< T, N >::operator()   u,
  v
const [inline, 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::NurbsSurface.

Definition at line 86 of file hnurbsS.h.

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

Read a HNURBS surface from a file stream.

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

Reimplemented from PLib::NurbsSurface.

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 988 of file hnurbsS.cpp.

References addLevel, PLib::NurbsSurface::P, PLib::NurbsSurface::resize, PLib::NurbsSurface::U, updateSurface, and PLib::NurbsSurface::V.

template<class T, int N>
int PLib::HNurbsSurface< T, N >::read const char *    filename
 

Reads a HNURBS surface from a file.

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

Reimplemented from PLib::NurbsSurface.

Reimplemented in PLib::HNurbsSurfaceGL.

Definition at line 1123 of file hnurbsS.cpp.

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

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 1260 of file hnurbsS.cpp.

References initBase, refineKnotU, and refineKnotV.

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

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 1279 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, PLib::NurbsSurface::U, updateSurface, and PLib::NurbsSurface::V.

Referenced by refineKnots.

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

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 1321 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, PLib::NurbsSurface::U, updateSurface, and PLib::NurbsSurface::V.

Referenced by refineKnots.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::scale const Point_nD< T, N > &    s
 

Scales the object.

Parameters:
s  the scaling factor
Author:
Philippe Lavoie
Date:
11 June 1998

Definition at line 1409 of file hnurbsS.cpp.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::setFixedOffsetVector const Point_nD< T, N > &    I,
const Point_nD< T, N > &    J,
const Point_nD< T, N > &    K
 

The offset vector are fixed.

Fixes the offset vector direction to a unique value. The offset vector's direction won't depend on its base layer.

Parameters:
I  the i vector
J  the j vector
K  the k vector
Author:
Philippe Lavoie
Date:
11 June 1998

Definition at line 1437 of file hnurbsS.cpp.

References initBase, and updateSurface.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::setVariableOffsetVector  
 

The offset vector are variable.

Fixes the offsset vector direction to a variable value. The value depends on its base layer.

Author:
Philippe Lavoie
Date:
11 June 1998

Definition at line 1457 of file hnurbsS.cpp.

References initBase, and updateSurface.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::splitUV int    nu,
int    su,
int    nv,
int    sv,
Vector< T > &    nU,
Vector< T > &    nV
 

Insert n knots betwen each knots.

Insert nu knots betwen each knots in the U vector and nv knots between each knots in the V vector.

This doesn't not perform a split. It just generates a suitable rU and rV vector. It is suggested that splitting should be done for the level above, not the local level.

Parameters:
nu  the number of new knots between each knots in U.
su  the multiplicity of the each new knot in U
nv  the number of new knots between each knots in V.
sv  the multiplicity of the each new knot in V
nU  the new refinement knot vector in U
nV  the new refinement knot vector in V
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 803 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, PLib::NurbsSurface::knotU, and PLib::NurbsSurface::knotV.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::splitUV int    nu,
int    nv,
Vector< T > &    nU,
Vector< T > &    nV
 

Insert n knots betwen each knots.

Insert nu knots betwen each knots in the U vector and nv knots between each knots in the V vector.

This does not perform a split. It just generates a suitable rU and rV vector. It is suggested that splitting should be done for the level above, not the local level.

Parameters:
nu  the number of new knots between each knots in U.
nv  the number of new knots between each knots in V.
nU  the new refinement knot vector in U
nV  the new refinement knot vector in V
Author:
Philippe Lavoie
Date:
7 October 1997

Definition at line 743 of file hnurbsS.cpp.

References PLib::NurbsSurface::knotU, and PLib::NurbsSurface::knotV.

Referenced by PLib::HNurbsSurfaceSP::addLevel, and addLevel.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::updateLevels int    upLevel = -1 [virtual]
 

Update the surface for all the levels.

Parameters:
upLevel  updates the levels up to this level of detail
Author:
Philippe Lavoie
Date:
7 October 1997

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 707 of file hnurbsS.cpp.

References updateSurface.

template<class T, int N>
void PLib::HNurbsSurface< T, N >::updateSurface int    i0 = -1,
int    j0 = -1
[virtual]
 

updates the NURBS surface.

Updates the NURBS surface according to the offset values and its base level. You can update only one control point from the surface if you specify a value for i and j or you can update all the points if i0 or j0 is below 0.

Parameters:
i0  the row of the control point to update
j0  the column of the control point to update
Author:
Philippe Lavoie
Date:
7 October 1997

Reimplemented in PLib::HNurbsSurfaceSP.

Definition at line 330 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, initBase, PLib::NurbsSurface::P, PLib::NurbsSurface::U, and PLib::NurbsSurface::V.

Referenced by movePointOffset, read, refineKnotU, refineKnotV, setFixedOffsetVector, setVariableOffsetVector, and updateLevels.

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

Write a HNURBS surface to a file stream.

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

Reimplemented from PLib::NurbsSurface.

Reimplemented in PLib::HNurbsSurfaceGL.

Definition at line 1143 of file hnurbsS.cpp.

References PLib::NurbsSurface::degU, PLib::NurbsSurface::degV, PLib::NurbsSurface::P, PLib::NurbsSurface::U, and PLib::NurbsSurface::V.

template<class T, int N>
int PLib::HNurbsSurface< T, N >::write const char *    filename const
 

write a HNURBS surface to a file.

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

Reimplemented from PLib::NurbsSurface.

Reimplemented in PLib::HNurbsSurfaceGL.

Definition at line 1219 of file hnurbsS.cpp.


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