#include <hnurbsS.h>
Inheritance diagram for PLib::HNurbsSurface< T, N >:
Public Member Functions | |
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_ |
T | uS_ |
T | uE_ |
T | vS_ |
T | vE_ |
T | uD |
T | vD |
int | fixedOffset |
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.
PLib::HNurbsSurface< T, N >::HNurbsSurface | ( | ) |
The basic constructor.
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.
S | the NURBS surface at level 0 |
PLib::HNurbsSurface< T, N >::HNurbsSurface | ( | const HNurbsSurface< T, N > & | S | ) |
The copy constructor.
S | the HNURBS surface to copy |
PLib::HNurbsSurface< T, N >::HNurbsSurface | ( | HNurbsSurface< T, N > * | base | ) |
Constructor with a base level.
base | the base level | |
xU | the U knots to insert in this level | |
xV | the V knots to insert in this level |
PLib::HNurbsSurface< T, N >::HNurbsSurface | ( | HNurbsSurface< T, N > * | base, | |
const Vector< T > & | xU, | |||
const Vector< T > & | xV | |||
) |
Constructor with a base level.
base | the base level | |
xU | the U knots to insert in this level | |
xV | the V knots to insert in this level |
PLib::HNurbsSurface< T, N >::HNurbsSurface | ( | HNurbsSurface< T, N > * | base, | |
const HNurbsSurface< T, N > & | surf | |||
) |
A level constructor.
base | the base of this level | |
the | values for this new level |
PLib::HNurbsSurface< T, N >::~HNurbsSurface | ( | ) | [virtual] |
Destructor.
Deletes all the levels.
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.
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 |
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.
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 |
HNurbsSurface< T, N > * PLib::HNurbsSurface< T, N >::addLevel | ( | int | n | ) | [virtual] |
Adds a level to this HNURBS surface.
n | the number of new knots between each knots. |
HNurbsSurface< T, N > * PLib::HNurbsSurface< T, N >::addLevel | ( | ) | [virtual] |
Adds a level to this HNURBS surface.
n | the number of new knots between each knots. |
Reimplemented in PLib::HNurbsSurfaceSP< T, N >, PLib::HNurbsSurfaceGL, and PLib::HNurbsSurfaceSP< float, 3 >.
void PLib::HNurbsSurface< T, N >::copy | ( | const HNurbsSurface< T, N > & | nS | ) | [virtual] |
Copies a HNurbs Surface and all it children.
ns | the HNurbs surface to copy |
Reimplemented in PLib::HNurbsSurfaceSP< T, N >.
int PLib::HNurbsSurface< T, N >::modifies | ( | T | u, | |
T | v | |||
) |
Specifies the level that modifies the point.
Specifies what level modifies the point (u,v)
u | the u parametric value | |
v | the v parametric value |
HPoint_nD<T,N> PLib::HNurbsSurface< T, N >::operator() | ( | T | u, | |
T | v | |||
) | const [inline, virtual] |
Returns the point on the surface at u,v.
Returns the point on the surface at u,v
u | the u parametric value | |
v | the v parametric value |
Reimplemented from PLib::NurbsSurface< T, N >.
HPoint_nD< T, N > PLib::HNurbsSurface< T, N >::hpointAt | ( | T | u, | |
T | v, | |||
int | lod = -1 | |||
) | const |
finds the homogenous point at (u,v) for a certain level of detail.
u | the u parametric value | |
v | the v parametric value | |
lod | the level of detail3 |
void PLib::HNurbsSurface< T, N >::deriveAtH | ( | T | u, | |
T | 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.
u | the u parametric value | |
v | the v parametric value | |
ders | the Matrix of derivatives. |
void PLib::HNurbsSurface< T, N >::deriveAt | ( | T | u, | |
T | 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.
u | the u parametric value | |
v | the v parametric value | |
ders | the Matrix of derivatives. |
int PLib::HNurbsSurface< T, N >::movePointOffset | ( | T | u, | |
T | 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.
u | the parameter in the u direction | |
v | the parameter in the v direction | |
delta | the displacement of the point s(u,v) |
void PLib::HNurbsSurface< T, N >::scale | ( | const Point_nD< T, N > & | s | ) |
Scales the object.
s | the scaling factor |
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.
force | if set, this forces an update of the base surface |
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.
i0 | the row of the control point to update | |
j0 | the column of the control point to update |
Reimplemented in PLib::HNurbsSurfaceSP< T, N >, and PLib::HNurbsSurfaceSP< float, 3 >.
void PLib::HNurbsSurface< T, N >::updateLevels | ( | int | upLevel = -1 |
) | [virtual] |
Update the surface for all the levels.
upLevel | updates the levels up to this level of detail |
Reimplemented in PLib::HNurbsSurfaceSP< T, N >, and PLib::HNurbsSurfaceSP< float, 3 >.
int PLib::HNurbsSurface< T, N >::isoCurveU | ( | T | 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.
u | the U parametric value | |
c | the iso-parametric curve | |
lod | the level of detail to draw the curve with |
int PLib::HNurbsSurface< T, N >::isoCurveV | ( | T | 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.
v | the V parametric value | |
c | the iso-parametric curve | |
lod | the level of detail to draw the curve with |
int PLib::HNurbsSurface< T, N >::read | ( | const char * | filename | ) |
Reads a HNURBS surface from a file.
filename | the filename to read from |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceGL.
int PLib::HNurbsSurface< T, N >::write | ( | const char * | filename | ) | const |
write a HNURBS surface to a file
filename | the filename to write to |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceGL.
int PLib::HNurbsSurface< T, N >::read | ( | ifstream & | fin | ) | [virtual] |
Read a HNURBS surface from a file stream.
fin | the input file stream |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceSP< T, N >, PLib::HNurbsSurfaceGL, and PLib::HNurbsSurfaceSP< float, 3 >.
int PLib::HNurbsSurface< T, N >::write | ( | ofstream & | fout | ) | const |
Write a HNURBS surface to a file stream.
fout | the output filestream to write to. |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceGL.
int PLib::HNurbsSurface< T, N >::maxLevel | ( | ) | const |
the maximum level of detail
Finds the maximum level of detail available from this HNURBS surface
void PLib::HNurbsSurface< T, N >::refineKnots | ( | const Vector< T > & | nU, | |
const Vector< T > & | nV | |||
) | [virtual] |
Refine both knot vectors.
nU | the U knot vector to refine from | |
nV | the V knot vector to refine from |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceSP< T, N >.
void PLib::HNurbsSurface< T, N >::refineKnotU | ( | const Vector< T > & | X | ) | [virtual] |
Refines the U knot vector.
X | the knot vector to refine from |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceSP< T, N >.
void PLib::HNurbsSurface< T, N >::refineKnotV | ( | const Vector< T > & | X | ) | [virtual] |
Refines the V knot vector.
X | the knot vector to refine from |
Reimplemented from PLib::NurbsSurface< T, N >.
Reimplemented in PLib::HNurbsSurfaceSP< T, 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.
I | the i vector | |
J | the j vector | |
K | the k vector |
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.