00001 /* LIBGUL - Geometry Utility Library 00002 * Copyright (C) 1998-1999 Norbert Irmer 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Library General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public 00015 * License along with this library; if not, write to the 00016 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00017 * Boston, MA 02111-1307, USA. 00018 */ 00019 00020 #ifndef GUNU_RAISE_DEGREE_H 00021 #define GUNU_RAISE_DEGREE_H 00022 00023 namespace gunu { 00024 00025 using gul::Ptr; 00026 00027 /*-------------------------------------------------------------------------*//** 00028 raise the degree 'p' of a curve to 'p+t'. this function doesn't reserves 00029 memory for Uh and Q, in the worst case for Q: p + (n-p+1)*(t+1), and for 00030 Uh: 2*p + (n-p+2)*(t+1) elements are needed, the function returns the new 00031 number of controlpoints - 1 */ 00032 /*----------------------------------------------------------------------------*/ 00033 template< class T, class HP > 00034 int ElevateCurveDegree( int n, int p, Ptr<T>& U, Ptr<HP>& Pw, int t, 00035 Ptr<T>& Uh, Ptr<HP>& Qw ); 00036 00037 00038 /*-------------------------------------------------------------------------*//** 00039 raise the degree 'pu' or 'pv' of a surface by 't'. this function doesn't 00040 reserves memory for Uh,Vh and Qw, they must be dimensioned in u or v 00041 direction like for curves. */ 00042 /*----------------------------------------------------------------------------*/ 00043 template< class T, class HP > 00044 void ElevateSurfaceDegreeU( 00045 int nu, int pu, const Ptr<T>& U, int nv, int pv, const Ptr<T>& V, 00046 const Ptr< Ptr<HP> >& Pw, int t, 00047 int *nhu, Ptr<T>& Uh, int *nhv, Ptr<T>& Vh, 00048 Ptr< Ptr<HP> >& Qw ); 00049 00050 template< class T, class HP > 00051 void ElevateSurfaceDegreeV( 00052 int nu, int pu, const Ptr<T>& U, int nv, int pv, const Ptr<T>& V, 00053 const Ptr< Ptr<HP> >& Pw, int t, 00054 int *nhu, Ptr<T>& Uh, int *nhv, Ptr<T>& Vh, 00055 Ptr< Ptr<HP> >& Qw ); 00056 00057 template< class T, class HP > 00058 void ElevateSurfaceDegree( 00059 int nu, int pu, Ptr<T>& U, int nv, int pv, Ptr<T>& V, 00060 Ptr< Ptr<HP> >& Pw, int t, int dir, 00061 int *nhu, Ptr<T>& Uh, int *nhv, Ptr<T>& Vh, 00062 Ptr< Ptr<HP> >& Qw ) 00063 { 00064 if( dir == gul::u_direction ) 00065 ElevateSurfaceDegreeU( nu,pu,U,nv,pv,V,Pw,t,nhu,Uh,nhv,Vh,Qw ); 00066 else 00067 ElevateSurfaceDegreeV( nu,pu,U,nv,pv,V,Pw,t,nhu,Uh,nhv,Vh,Qw ); 00068 } 00069 00070 00071 00072 } 00073 00074 #endif 00075 00076 00077 00078 00079