hnurbsS.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
#ifndef _nurbs_hnurbs_h_
00026
#define _nurbs_hnurbs_h_
00027
00028
#include "nurbsS.h"
00029
#include "vector.h"
00030
00033
namespace PLib {
00034
00058
template <
class T,
int N>
00059 class HNurbsSurface:
public NurbsSurface<T,N> {
00060
public:
00061
HNurbsSurface() ;
00062
HNurbsSurface(
const NurbsSurface<T,N>& S) ;
00063
HNurbsSurface(
const HNurbsSurface<T,N>& S) ;
00064
HNurbsSurface(
HNurbsSurface<T,N>* base) ;
00065
HNurbsSurface(
HNurbsSurface<T,N>* base,
const Vector<T>& xU,
const Vector<T>& xV) ;
00066
HNurbsSurface(
HNurbsSurface<T,N>* base,
const HNurbsSurface<T,N> &surf) ;
00067
virtual ~HNurbsSurface() ;
00068
00069
HNurbsSurface<T,N>* baseLevel()
const {
return baseLevel_;}
00070
HNurbsSurface<T,N>* nextLevel()
const {
return nextLevel_;}
00071
HNurbsSurface<T,N>* firstLevel()
const {
return firstLevel_;}
00072
HNurbsSurface<T,N>* lastLevel()
const {
return lastLevel_; }
00073
00074
void splitUV(
int nu,
int nv,
Vector<T> &nU,
Vector<T> &nV) ;
00075
void splitUV(
int nu,
int su,
int nv,
int sv,
Vector<T> &nU,
Vector<T> &nV) ;
00076
00077
virtual HNurbsSurface<T,N>*
addLevel(
int nsplit) ;
00078
virtual HNurbsSurface<T,N>*
addLevel() ;
00079
00080
virtual void copy(
const HNurbsSurface<T,N>& nS) ;
00081
00082
int modifies(T u, T v) ;
00083
00084
00085 HPoint_nD<T,N> operator()(T u, T v)
const {
return hpointAt(u,v,-1) ; }
00086
HPoint_nD<T,N> hpointAt(T u, T v,
int lod=-1)
const ;
00087
00088
void deriveAtH(T u, T v,
int,
Matrix<
HPoint_nD<T,N> >&,
int lod=-1)
const;
00089
void deriveAt(T u, T v,
int,
Matrix<
Point_nD<T,N> >&,
int lod=-1)
const;
00090
00091
int movePointOffset(T u, T v,
const Point_nD<T,N>& delta) ;
00092
00093
void scale(
const Point_nD<T,N>& s) ;
00094
00095
00096
int initBase(
int force=0) ;
00097
virtual void updateSurface(
int i0=-1,
int j0=-1) ;
00098
virtual void updateLevels(
int updateLevel=-1) ;
00099
00100
int isoCurveU(T u,
NurbsCurve<T,N>& c,
int lod=-1)
const ;
00101
int isoCurveV(T v,
NurbsCurve<T,N>& c,
int lod=-1)
const ;
00102
00103
00104
int read(
const char* filename);
00105
int write(
const char* filename)
const;
00106
virtual int read(ifstream &fin) ;
00107
int write(ofstream &fout)
const ;
00108
00109
Matrix< HPoint_nD<T,N> > offset ;
00110
Vector<T> rU,rV ;
00111
00112
int level()
const {
return level_ ;}
00113
00114
int maxLevel() const ;
00115
00116
int modifiedN()
const {
return updateN ; }
00117
00118
void refineKnots(
const Vector<T>& nU,
const Vector<T>& nV) ;
00119
void refineKnotU(
const Vector<T>& X) ;
00120
void refineKnotV(
const Vector<T>& X) ;
00121
00122
00123
void axis(
int i,
int j, Point_nD<T,N>& xaxis, Point_nD<T,N>& yaxis, Point_nD<T,N>& zaxis)
const;
00124
00125
void setFixedOffsetVector(
const Point_nD<T,N> &I,
const Point_nD<T,N> &J,
const Point_nD<T,N>& K);
00126
void setVariableOffsetVector();
00127
00128
protected:
00129 NurbsSurface<T,N> baseSurf ;
00130 HNurbsSurface<T,N> *baseLevel_,*nextLevel_,*firstLevel_,*lastLevel_ ;
00131
00132 Matrix< Point_nD<T,N> > ivec,jvec,kvec ;
00133
00134
int level_ ;
00135
int updateN,baseUpdateN ;
00136
int update_ ;
00137
00138 T uS_,uE_,vS_,vE_ ;
00139 T uD,vD ;
00140
int fixedOffset;
00141 };
00142
00143
template <
class T,
int N>
00144
inline void
00145 HNurbsSurface<T,N>::axis(
int i,
int j, Point_nD<T,N>& xaxis, Point_nD<T,N>& yaxis, Point_nD<T,N>& zaxis)
const
00146
{
00147
if(baseLevel_) {
00148 xaxis = ivec(i,j) ;
00149 yaxis = jvec(i,j) ;
00150 zaxis = kvec(i,j) ;
00151 }
00152
else{
00153 xaxis = Point_nD<T,N>(T(1),T(0),T(0)) ;
00154 yaxis = Point_nD<T,N>(T(0),T(1),T(0)) ;
00155 zaxis = Point_nD<T,N>(T(0),T(0),T(1)) ;
00156 }
00157 }
00158
00159
typedef HNurbsSurface<float,3> HNurbsSurfacef ;
00160
typedef HNurbsSurface<double,3> HNurbsSurfaced ;
00161
00162 }
00163
00164
typedef PLib::HNurbsSurface<float,3> PlHNurbsSurfacef ;
00165
typedef PLib::HNurbsSurface<double,3> PlHNurbsSurfaced ;
00166
00167
00168
#endif // _nurbs_hnurbs_h_
Generated on Fri Aug 13 11:03:45 2004 for NURBS++ by
1.3.7