Main Page   Class Hierarchy   Compound List   File List   Compound Members  

nurbs_sp.cpp

00001 /*=====================================================================
00002         File: nurbs_sp.cpp
00003      Purpose:       
00004     Revision: $Id: nurbs_sp.cpp,v 1.3 2003/01/13 19:42:25 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 
00026 #ifndef PLIB_NURBS_NURBS_SP_SOURCE
00027 #define PLIB_NURBS_NURBS_SP_SOURCE
00028 
00029 
00030 
00031 #include <nurbs_sp.h>
00032 
00035 namespace PLib {
00036 
00048 template <class T, int N>
00049 void NurbsCurveSP<T,N>::updateMaxU() {
00050   if(deg_>3){
00051 #ifdef USE_EXCEPTION
00052     throw NurbsInputError();
00053 #else
00054     Error error("NurbsCurveSP") ; 
00055     error << "This class can't handle a curve of degree 4 or higher.\n" ;
00056     error.fatal() ;
00057 #endif
00058   }
00059   else{
00060     maxU.resize(P.n()) ;
00061     maxAt_.resize(P.n()) ;
00062     for(int i=0;i<P.n();++i){
00063       if(!maxInfluence(i,U,deg_,maxAt_[i]))
00064         cerr << "Problem in maxInfluence U!\n" ;
00065       if(i>0)
00066         if(maxAt_[i]<maxAt_[i-1]){
00067 #ifdef USE_EXCEPTION
00068           throw NurbsError();
00069 #else
00070           Error error("Error updating maxU");
00071           error << "HUGE ERROR!\n" ;
00072           error << "Knot = " << U << endl ;
00073           error << " i = " << i << endl ;
00074           error << " deg = " << deg_ << endl ;
00075           error.fatal() ; 
00076 #endif
00077         }
00078       maxU[i] = basisFun(maxAt_[i],i,deg_) ;
00079     }
00080     
00081   }
00082 }
00083 
00103 template <class T, int N>
00104 void NurbsCurveSP<T,N>::modOnlySurfCPby(int i, const HPoint_nD<T,N>& a){
00105   Vector<T> u(2*deg_+3) ;
00106   Vector< Point_nD<T,N> > pts(2*deg_+3) ; 
00107 
00108   int n=0;
00109   for(int j=i-deg_-1;j<=i+deg_+1;++j){
00110     if(j<0)
00111       continue ;
00112     if(j>=P.n())
00113       break ; 
00114     u[n] = maxAt_[j] ;
00115     if( j == i){
00116       pts[n].x() = a.x() ; 
00117       pts[n].y() = a.y() ; 
00118       pts[n].z() = a.z() ; 
00119     }
00120     //else
00121     //  pts[n] = Point3D(0,0,0) ; pts is alredy set to 0,0,0
00122     ++n ;
00123   }  
00124 
00125   u.resize(n) ;
00126   pts.resize(n) ; 
00127 
00128   movePoint(u,pts) ;
00129 }
00130 
00131 } // end namespace
00132 
00133 
00134 #endif // #define PLIB_NURBS_NURBS_SP_SOURCE
00135 
00136 

Generated on Tue Jun 24 13:26:57 2003 for NURBS++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002