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

nurbs_sp.h

00001 /*============================================================================= 00002 File: nurbs_sp.h 00003 Purpose: 00004 Revision: $Id: nurbs_sp.h,v 1.3 2002/05/17 18:24:21 philosophil Exp $ 00005 Created by: Philippe Lavoie (7 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_nurbs_sp_h_ 00026 #define _nurbs_nurbs_sp_h_ 00027 00028 #include "nurbs.h" 00029 00032 namespace PLib { 00033 00046 template <class T, int N> 00047 class NurbsCurveSP : public NurbsCurve<T,N>{ 00048 public: 00049 NurbsCurveSP() : NurbsCurve<T,N>() { ; } 00050 NurbsCurveSP(const NurbsCurve<T,N>& nurb) ; 00051 NurbsCurveSP(const NurbsCurveSP<T,N>& nurb) ; 00052 NurbsCurveSP(const Vector< HPoint_nD<T,N> >& P1, const Vector<T> &U1, int degree=3) ; 00053 NurbsCurveSP(const Vector< Point_nD<T,N> >& P1, const Vector<T> &W, const Vector<T> &U1, int degree=3) ; 00054 00055 00056 virtual void reset(const Vector< HPoint_nD<T,N> >& P1, const Vector<T> &U1, int degree); 00057 virtual NurbsCurve<T,N>& operator=(const NurbsCurve<T,N>& a); 00058 NurbsCurveSP<T,N>& operator=(const NurbsCurveSP<T,N>& a); 00059 00060 virtual void modKnot(const Vector<T>& knot) ; 00061 00062 virtual void removeKnot(int r, int s, int num) ; 00063 virtual void removeKnotsBound(const Vector<T>& ub, Vector<T>& ek, T E); 00064 00065 virtual void refineKnotVector(const Vector<T>& X) ; 00066 virtual void mergeKnotVector(const Vector<T> &Um) ; 00067 virtual void knotInsertion(T u, int r,NurbsCurveSP<T,N>& nc); 00068 00069 00070 virtual void degreeElevate(int t); 00071 00072 int read(ifstream &fin) ; 00073 00074 void modSurfCPby(int i, const HPoint_nD<T,N>& a) 00075 { P[i] += a / maxU[i] ; } 00076 void modSurfCP(int i, const HPoint_nD<T,N>& a) 00077 { modSurfCPby(i,a-surfP(i)) ; } 00078 00079 void modOnlySurfCPby(int i, const HPoint_nD<T,N>& a) ; 00080 void modOnlySurfCP(int i, const HPoint_nD<T,N>& a) 00081 { modOnlySurfCPby(i,a-surfP(i)) ; } 00082 00083 T maxAt(int i) const 00084 { return maxAt_[i] ; } 00085 00086 HPoint_nD<T,N> surfP(int i) const 00087 { return hpointAt(maxAt_[i]) ; } 00088 00089 void updateMaxU() ; 00090 00091 int okMax() 00092 { return (maxU.n()<=1)?0:1 ; } 00093 00094 protected: 00095 00096 Vector<T> maxU ; 00097 Vector<T> maxAt_ ; 00098 }; 00099 00100 00101 template <class T, int N> 00102 inline NurbsCurveSP<T,N>::NurbsCurveSP(const NurbsCurve<T,N>& nurb) : 00103 NurbsCurve<T,N>(nurb) 00104 { 00105 updateMaxU(); 00106 } 00107 00108 template <class T, int N> 00109 inline NurbsCurveSP<T,N>::NurbsCurveSP(const NurbsCurveSP<T,N>& nurb) : 00110 NurbsCurve<T,N>(nurb) 00111 { 00112 maxU = nurb.maxU ; 00113 maxAt_ = nurb.maxAt_ ; 00114 } 00115 00116 template <class T, int N> 00117 inline NurbsCurveSP<T,N>::NurbsCurveSP(const Vector< HPoint_nD<T,N> >& P1, const Vector<T> &U1, int degree) : 00118 NurbsCurve<T,N>(P1,U1,degree) 00119 { 00120 updateMaxU(); 00121 } 00122 00123 template <class T, int N> 00124 inline NurbsCurveSP<T,N>::NurbsCurveSP(const Vector< Point_nD<T,N> >& P1, const Vector<T> &W, const Vector<T> &U1, int degree) : 00125 NurbsCurve<T,N>(P1,W,U1,degree) 00126 { 00127 updateMaxU(); 00128 } 00129 00130 00131 template <class T, int N> 00132 inline void NurbsCurveSP<T,N>::reset(const Vector< HPoint_nD<T,N> >& P1, const Vector<T> &U1, int degree) { 00133 NurbsCurve<T,N>::reset(P1,U1,degree); 00134 updateMaxU() ; 00135 } 00136 00137 template <class T, int N> 00138 inline NurbsCurve<T,N>& NurbsCurveSP<T,N>::operator=(const NurbsCurve<T,N>& a) { 00139 NurbsCurve<T,N>::operator=(a); 00140 updateMaxU() ; 00141 return *this; 00142 } 00143 00144 template <class T, int N> 00145 inline NurbsCurveSP<T,N>& NurbsCurveSP<T,N>::operator=(const NurbsCurveSP<T,N>& a) { 00146 NurbsCurve<T,N>::operator=(a); 00147 maxU = a.maxU ; 00148 maxAt_ = a.maxAt_ ; 00149 return *this; 00150 } 00151 00152 template <class T, int N> 00153 inline void NurbsCurveSP<T,N>::modKnot(const Vector<T>& knot) { 00154 NurbsCurve<T,N>::modKnot(knot) ; 00155 updateMaxU() ; 00156 } 00157 00158 template <class T, int N> 00159 inline void NurbsCurveSP<T,N>::removeKnot(int r, int s, int num) { 00160 NurbsCurve<T,N>::removeKnot(r,s,num); 00161 updateMaxU() ; 00162 } 00163 00164 template <class T, int N> 00165 inline void NurbsCurveSP<T,N>::removeKnotsBound(const Vector<T>& ub, Vector<T>& ek, T E) { 00166 NurbsCurve<T,N>::removeKnotsBound(ub,ek,E); 00167 updateMaxU() ; 00168 } 00169 00170 template <class T, int N> 00171 inline void NurbsCurveSP<T,N>::refineKnotVector(const Vector<T>& X) { 00172 NurbsCurve<T,N>::refineKnotVector(X); 00173 updateMaxU() ; 00174 } 00175 00176 template <class T, int N> 00177 inline void NurbsCurveSP<T,N>::mergeKnotVector(const Vector<T> &Um) { 00178 NurbsCurve<T,N>::mergeKnotVector(Um); 00179 updateMaxU() ; 00180 } 00181 00182 template <class T, int N> 00183 inline void NurbsCurveSP<T,N>::knotInsertion(T u, int r,NurbsCurveSP<T,N>& nc){ 00184 NurbsCurve<T,N>::knotInsertion(u,r,nc) ; 00185 nc.updateMaxU() ; 00186 } 00187 00188 template <class T, int N> 00189 inline int NurbsCurveSP<T,N>::read(ifstream &fin) { 00190 int r = NurbsCurve<T,N>::read(fin) ; 00191 updateMaxU() ; 00192 return r ; 00193 } 00194 00195 template <class T, int N> 00196 inline void NurbsCurveSP<T,N>::degreeElevate(int t){ 00197 NurbsCurve<T,N>::degreeElevate(t) ; 00198 updateMaxU() ; 00199 } 00200 00201 00202 typedef NurbsCurveSP<float,3> NurbsCurveSPf ; 00203 typedef NurbsCurveSP<double,3> NurbsCurveSPd ; 00204 typedef NurbsCurveSP<float,3> NurbsCurveSP_2Df ; 00205 typedef NurbsCurveSP<double,3> NurbsCurveSP_2Dd ; 00206 00207 } // end namespace 00208 00209 typedef PLib::NurbsCurveSP<float,3> PlNurbsCurveSPf ; 00210 typedef PLib::NurbsCurveSP<double,3> PlNurbsCurveSPd ; 00211 typedef PLib::NurbsCurveSP<float,3> PlNurbsCurveSP_2Df ; 00212 typedef PLib::NurbsCurveSP<double,3> PlNurbsCurveSP_2Dd ; 00213 00214 00215 00216 #endif

Generated on Wed Aug 18 07:07:37 2004 for NURBS++ by doxygen 1.3.7