Main Page | Class Hierarchy | Class List | File List | Class Members

nurbsS_sp.h

00001 /*============================================================================= 00002 File: nurbsS_sp.h 00003 Purpose: 00004 Revision: $Id: nurbsS_sp.h,v 1.2 2002/05/13 21:07:46 philosophil Exp $ 00005 Created by: Philippe Lavoie (8 May, 1998) 00006 Modified by: 00007 00008 Copyright notice: 00009 Copyright (C) 1996-1997 Philippe Lavoie 00010 00011 This library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU Library General Public 00013 License as published by the Free Software Foundation; either 00014 version 2 of the License, or (at your option) any later version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Library General Public License for more details. 00020 00021 You should have received a copy of the GNU Library General Public 00022 License along with this library; if not, write to the Free 00023 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00024 =============================================================================*/ 00025 #ifndef _nurbs_nurbsS_sp_h_ 00026 #define _nurbs_nurbsS_sp_h_ 00027 00028 #include "nurbsS.h" 00029 00032 namespace PLib { 00033 00047 template <class T, int N> 00048 class NurbsSurfaceSP : public NurbsSurface<T,N>{ 00049 public: 00050 NurbsSurfaceSP(); 00051 NurbsSurfaceSP(const NurbsSurface<T,N>& nS); 00052 NurbsSurfaceSP(const NurbsSurfaceSP<T,N>& nS); 00053 NurbsSurfaceSP(int DegU, int DegV, const Vector<T>& Uk, const Vector<T>& Vk, const Matrix< HPoint_nD<T,N> >& Cp); 00054 NurbsSurfaceSP(int DegU, int DegV, Vector<T>& Uk, Vector<T>& Vk, Matrix< Point_nD<T,N> >& Cp, Matrix<T>& W) ; 00055 00056 00057 virtual NurbsSurface<T,N>& operator=(const NurbsSurface<T,N>& a) ; 00058 virtual NurbsSurfaceSP<T,N>& operator=(const NurbsSurfaceSP<T,N>& a) ; 00059 00060 virtual void resizeKeep(int Pu, int Pv, int DegU, int DegV) ; 00061 00062 00063 virtual void refineKnots(const Vector<T>& nU, const Vector<T>& nV) ; 00064 virtual void refineKnotU(const Vector<T>& X); 00065 virtual void refineKnotV(const Vector<T>& X); 00066 00067 virtual void mergeKnots(const Vector<T>& nU, const Vector<T>& nV) ; 00068 virtual void mergeKnotU(const Vector<T>& X); 00069 virtual void mergeKnotV(const Vector<T>& X); 00070 00071 virtual int read(ifstream &fin); 00072 00073 00074 virtual void degreeElevateU(int tU); 00075 virtual void degreeElevateV(int tV); 00076 00077 NurbsSurfaceSP<T,N> generateParallel(T d) const ; 00078 00079 00080 void modSurfCPby(int i, int j, const HPoint_nD<T,N>& a) 00081 { P(i,j) += a / (maxU[i]*maxV[j]) ; } 00082 void modSurfCP(int i, int j, const HPoint_nD<T,N>& a) 00083 { modSurfCPby(i,j,a-surfP(i,j)) ; } 00084 00085 void modOnlySurfCPby(int i, int j, const HPoint_nD<T,N>& a) ; 00086 void modOnlySurfCP(int i, int j, const HPoint_nD<T,N>& a) 00087 { modOnlySurfCPby(i,j,a-surfP(i,j)) ; } 00088 00089 T maxAtUV(int i, int j) const 00090 { return maxAtU_[i]*maxAtV_[j] ; } 00091 T maxAtU(int i) const 00092 { return maxAtU_[i] ; } 00093 T maxAtV(int i) const 00094 { return maxAtV_[i] ; } 00095 00096 HPoint_nD<T,N> surfP(int i,int j) const 00097 { return hpointAt(maxAtU_[i],maxAtV_[j]); } 00098 00099 void updateMaxUV() 00100 { updateMaxU() ; updateMaxV() ; } 00101 void updateMaxU() ; 00102 void updateMaxV() ; 00103 00104 int okMax() 00105 { return (maxU.n()<=1)?0:1 ; } 00106 00107 protected: 00108 00109 Vector<T> maxU ; 00110 Vector<T> maxV ; 00111 Vector<T> maxAtU_ ; 00112 Vector<T> maxAtV_ ; 00113 }; 00114 00115 00125 template <class T, int N> 00126 inline NurbsSurfaceSP<T,N>::NurbsSurfaceSP() : NurbsSurface<T,N>() { 00127 ; 00128 } 00129 00139 template <class T, int N> 00140 inline NurbsSurfaceSP<T,N>::NurbsSurfaceSP(const NurbsSurface<T,N>& nS) : NurbsSurface<T,N>(nS) { 00141 updateMaxUV() ; 00142 } 00143 00153 template <class T, int N> 00154 inline NurbsSurfaceSP<T,N>::NurbsSurfaceSP(const NurbsSurfaceSP<T,N>& nS) : NurbsSurface<T,N>(nS) { 00155 maxU = nS.maxU ; 00156 maxV = nS.maxV ; 00157 maxAtU_ = nS.maxAtU_ ; 00158 maxAtV_ = nS.maxAtV_ ; 00159 } 00160 00174 template <class T, int N> 00175 inline NurbsSurfaceSP<T,N>::NurbsSurfaceSP(int DegU, int DegV, const Vector<T>& Uk, const Vector<T>& Vk, const Matrix< HPoint_nD<T,N> >& Cp) : NurbsSurface<T,N>(DegU,DegV,Uk,Vk,Cp) { 00176 updateMaxUV() ; 00177 } 00178 00193 template <class T, int N> 00194 inline NurbsSurfaceSP<T,N>::NurbsSurfaceSP(int DegU, int DegV, Vector<T>& Uk, Vector<T>& Vk, Matrix< Point_nD<T,N> >& Cp, Matrix<T>& W) : NurbsSurface<T,N>(DegU,DegV,Uk,Vk,Cp,W) { 00195 updateMaxUV() ; 00196 } 00197 00207 template <class T, int N> 00208 inline NurbsSurface<T,N>& 00209 NurbsSurfaceSP<T,N>::operator=(const NurbsSurface<T,N>& a) { 00210 NurbsSurface<T,N>::operator=(a) ; 00211 updateMaxUV() ; 00212 return *this ; 00213 } 00214 00223 template <class T, int N> 00224 inline NurbsSurfaceSP<T,N>& 00225 NurbsSurfaceSP<T,N>::operator=(const NurbsSurfaceSP<T,N>& a) { 00226 NurbsSurface<T,N>::operator=(a) ; 00227 maxU = a.maxU ; 00228 maxV = a.maxV ; 00229 maxAtU_ = a.maxAtU_ ; 00230 maxAtV_ = a.maxAtV_ ; 00231 return *this ; 00232 } 00233 00246 template <class T, int N> 00247 inline void 00248 NurbsSurfaceSP<T,N>::resizeKeep(int Pu, int Pv, int DegU, int DegV) { 00249 NurbsSurface<T,N>::resizeKeep(Pu,Pv,DegU,DegV) ; 00250 updateMaxUV() ; 00251 } 00252 00263 template <class T, int N> 00264 inline void 00265 NurbsSurfaceSP<T,N>::refineKnots(const Vector<T>& nU, const Vector<T>& nV) { 00266 NurbsSurface<T,N>::refineKnots(nU,nV) ; 00267 updateMaxUV() ; 00268 } 00269 00279 template <class T, int N> 00280 inline void 00281 NurbsSurfaceSP<T,N>::refineKnotU(const Vector<T>& X){ 00282 NurbsSurface<T,N>::refineKnotU(X) ; 00283 updateMaxU() ; 00284 } 00285 00295 template <class T, int N> 00296 inline void 00297 NurbsSurfaceSP<T,N>::refineKnotV(const Vector<T>& X){ 00298 NurbsSurface<T,N>::refineKnotV(X) ; 00299 updateMaxV() ; 00300 } 00301 00302 00303 /* 00304 \fn virtual void NurbsSurfaceSP<T,N>::mergeKnots(const Vector<T>& nU, const Vector<T>& nV) 00305 \brief Merge a knot vector in the U and V direction 00306 00307 \param nU the knot to merge with in the U direction 00308 \param nV the knot to merge with in the V direction 00309 00310 \author Philippe Lavoie 00311 */ 00312 template <class T, int N> 00313 inline void 00314 NurbsSurfaceSP<T,N>::mergeKnots(const Vector<T>& nU, const Vector<T>& nV) { 00315 NurbsSurface<T,N>::mergeKnots(nU,nV) ; 00316 updateMaxUV() ; 00317 } 00318 00319 00320 /* 00321 \fn virtual void NurbsSurfaceSP<T,N>::mergeKnotU(const Vector<T>& X) 00322 \brief Merge a knot vector in the U direction 00323 00324 \param X the knot to merge with 00325 00326 \author Philippe Lavoie 00327 */ 00328 template <class T, int N> 00329 inline void 00330 NurbsSurfaceSP<T,N>::mergeKnotU(const Vector<T>& X){ 00331 NurbsSurface<T,N>::mergeKnotU(X) ; 00332 updateMaxU() ; 00333 } 00334 00335 00336 /* 00337 \fn virtual void NurbsSurfaceSP<T,N>::mergeKnotV(const Vector<T>& X) 00338 \brief Merge a knot vector in the V direction 00339 00340 \param X the knot to merge with 00341 00342 \author Philippe Lavoie 00343 */ 00344 template <class T, int N> 00345 inline void 00346 NurbsSurfaceSP<T,N>::mergeKnotV(const Vector<T>& X){ 00347 NurbsSurface<T,N>::mergeKnotV(X) ; 00348 updateMaxV() ; 00349 } 00350 00351 /* 00352 \fn virtual int NurbsSurfaceSP<T,N>::read(ifstream &fin) 00353 \brief Reads an input file stream 00354 00355 \param fin the input file stream 00356 00357 \author Philippe Lavoie 00358 */ 00359 template <class T, int N> 00360 inline int NurbsSurfaceSP<T,N>::read(ifstream &fin) { 00361 int r = NurbsSurface<T,N>::read(fin) ; 00362 updateMaxUV() ; 00363 return r ; 00364 } 00365 00366 /* 00367 \fn virtual void NurbsSurfaceSP<T,N>::degreeElevateU(int tU) 00368 \brief Degree Elevate in the U direction 00369 00370 \param tU the number of degree to elevate the surface by 00371 00372 \author Philippe Lavoie 00373 */ 00374 template <class T, int N> 00375 inline void NurbsSurfaceSP<T,N>::degreeElevateU(int tU) { 00376 NurbsSurface<T,N>::degreeElevateU(tU); 00377 updateMaxU(); 00378 } 00379 00380 /* 00381 \fn virtual void NurbsSurfaceSP<T,N>::degreeElevateV(int tV) 00382 \brief Degree Elevate in the V direction 00383 00384 \param tV the number of degree to elevate the surface by 00385 00386 \author Philippe Lavoie 00387 */ 00388 template <class T, int N> 00389 inline void NurbsSurfaceSP<T,N>::degreeElevateV(int tV) { 00390 NurbsSurface<T,N>::degreeElevateV(tV); 00391 updateMaxV(); 00392 } 00393 00394 typedef NurbsSurfaceSP<float,3> NurbsSurfaceSPf ; 00395 typedef NurbsSurfaceSP<double,3> NurbsSurfaceSPd ; 00396 00397 } // end namespace 00398 00399 typedef PLib::NurbsSurfaceSP<float,3> PlNurbsSurfaceSPf ; 00400 typedef PLib::NurbsSurfaceSP<double,3> PlNurbsSurfaceSPd ; 00401 00402 00403 #endif

Generated on Sat May 15 00:00:00 2004 for NURBS++ by doxygen 1.3.7