A class to represent a NURBS surface. More...
Public Member Functions | |
NurbsSurface () | |
Default constructor. More... | |
NurbsSurface (const NurbsSurface &nS) | |
the copy constructor More... | |
const Vec & | knotU () const |
< A reference to the U knot vector | |
const Vec & | knotV () const |
< A reference to the V knot vector | |
double | knotU (int i) const |
< Returns the i-th knot from U | |
double | knotV (int i) const |
< Returns the i-th knot from V | |
const GeneralMatrix< Vec4 > & | ctrlPnts () const |
< A reference to the control points | |
const fmatvec::Vec4 | ctrlPnts (int i, int j) const |
< A reference to the control point at (i,j) | |
int | degreeU () const |
< A reference to the degree in U of the surface | |
int | degreeV () const |
< A reference to the degree in V of the surface | |
virtual NurbsSurface & | operator= (const NurbsSurface &) |
NurbsSurface assignment. More... | |
void | resize (int Pu, int Pv, int DegU, int DegV) |
Resize the surface. More... | |
fmatvec::HPoint< 3 > | operator() (double u, double v) const |
Returns the point on the surface at u,v. More... | |
fmatvec::Point< 3 > | pointAt (double u, double v) const |
Projects the point in the normal space. More... | |
void | deriveAt (double u, double v, int d, GeneralMatrix< Vec3 > &skl) const |
Find the non-zero basis functions in the U and V direction. More... | |
void | deriveAtH (double u, double v, int d, GeneralMatrix< Vec4 > &skl) const |
computes the point and the derivatives of degree d and below at (u,v) More... | |
Vec3 | normal (double u, double v) const |
Computes the normal of the surface at (u,v) More... | |
void | globalInterp (const GeneralMatrix< fmatvec::Vec3 > &Q, int DegU, int DegV) |
Generates a surface using global interpolation. More... | |
void | globalInterp (const GeneralMatrix< fmatvec::Vec3 > &Q, const Vec &uk, const Vec &vk, int DegU, int DegV) |
Generates a surface using global interpolation. More... | |
void | globalInterpClosedU (const GeneralMatrix< fmatvec::Vec3 > &Q, int DegU, int DegV) |
Generates a closed surface using global interpolation. More... | |
void | globalInterpClosedU (const GeneralMatrix< fmatvec::Vec3 > &Q, const Vec &uk, const Vec &vk, int DegU, int DegV) |
Generates a closed surface using global interpolation. More... | |
Protected Member Functions | |
void | findSpan (double u, double v, int spanU, int spanV) const |
Finds the multiplicity of a knot in the U knot. More... | |
int | findSpanU (double u) const |
finds the span in the U direction More... | |
int | findSpanV (double v) const |
finds the span in the V direction More... | |
int | findMultU (int r) const |
int | findMultV (int r) const |
Protected Attributes | |
fmatvec::Vec | U |
the U knot vector | |
fmatvec::Vec | V |
the V knot vector | |
GeneralMatrix< fmatvec::Vec4 > | P |
The matrix of control points. | |
int | degU |
the degree of the surface in U | |
int | degV |
the degree of the surface in V | |
Mat | InverseU |
The matrix for the computation of the control points in U-direction. | |
Mat | InverseV |
The matrix for the computation of the control points in V-direction. | |
Related Functions | |
(Note that these are not member functions.) | |
int | surfMeshParams (const GeneralMatrix< fmatvec::Vec3 > &Q, Vec &uk, Vec &vl) |
Computes the parameters for global surface interpolation. More... | |
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.
MBSim::NurbsSurface::NurbsSurface | ( | ) |
Default constructor.
MBSim::NurbsSurface::NurbsSurface | ( | const NurbsSurface & | nS | ) |
the copy constructor
s | the NurbsSurface to copy |
void MBSim::NurbsSurface::deriveAt | ( | double | u, |
double | v, | ||
int | d, | ||
GeneralMatrix< Vec3 > & | skl | ||
) | const |
Find the non-zero basis functions in the U and V direction.
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 |
Finds the non-zero basis function in the U direction
u | the u parametric value |
span | the span of u |
N | the vector containing the basis functions |
Finds the non-zero basis function in the V direction
v | the v parametric value |
span | the span of v |
N | the vector containing the basis functions |
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.
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 |
void MBSim::NurbsSurface::deriveAtH | ( | double | u, |
double | v, | ||
int | d, | ||
GeneralMatrix< Vec4 > & | 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.
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 |
|
protected |
Finds the multiplicity of a knot in the U knot.
r | the knot to observe |
finds the multiplicity of a knot in the V knot
r | the knot to observe |
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.
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 |
|
protected |
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.
u | –> find the span for this parametric value |
20 January, 1999 (Alejandro Frangi)
|
protected |
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.
v | find the span for this parametric value |
void MBSim::NurbsSurface::globalInterp | ( | const GeneralMatrix< fmatvec::Vec3 > & | Q, |
int | DegU, | ||
int | DegV | ||
) |
Generates a surface using global interpolation.
Q | a matrix of 3D points |
DegU | the degree of interpolation in the U direction |
DegV | the degree of interpolation in the V direction |
void MBSim::NurbsSurface::globalInterp | ( | const GeneralMatrix< fmatvec::Vec3 > & | Q, |
const Vec & | uk, | ||
const Vec & | vk, | ||
int | DegU, | ||
int | DegV | ||
) |
Generates a surface using global interpolation.
Q | a matrix of 3D points |
uk | the vector of lagrange parameters of the interpolated point in U direction |
vk | the vector of lagrange parameters of the interpolated point in V direction |
DegU | the degree of interpolation in the U direction |
DegV | the degree of interpolation in the V direction |
void MBSim::NurbsSurface::globalInterpClosedU | ( | const GeneralMatrix< fmatvec::Vec3 > & | Q, |
int | DegU, | ||
int | DegV | ||
) |
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.
Q | a matrix of 3D points (without repeated points) |
pU | the degree of interpolation in the U direction |
pV | the degree of interpolation in the V direction |
void MBSim::NurbsSurface::globalInterpClosedU | ( | const GeneralMatrix< fmatvec::Vec3 > & | Q, |
const Vec & | uk, | ||
const Vec & | vk, | ||
int | DegU, | ||
int | DegV | ||
) |
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.
Q | a matrix of 3D points (without repeated points) |
uk | the vector of lagrange parameters of the interpolated point in U direction |
vk | the vector of lagrange parameters of the interpolated point in V direction |
pU | the degree of interpolation in the U direction |
pV | the degree of interpolation in the V direction |
Vec3 MBSim::NurbsSurface::normal | ( | double | u, |
double | v | ||
) | const |
Computes the normal of the surface at (u,v)
u | the u parametric value |
v | the v parametric value |
fmatvec::HPoint< 3 > MBSim::NurbsSurface::operator() | ( | double | u, |
double | v | ||
) | const |
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 |
|
virtual |
fmatvec::Point< 3 > MBSim::NurbsSurface::pointAt | ( | double | u, |
double | v | ||
) | const |
Projects the point in the normal space.
< Projects the point in the normal space
void MBSim::NurbsSurface::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.
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 |
|
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.
Q | the matrix of 3D points |
uk | the knot coefficients in the U direction |
vl | the knot coefficients in the V direction |