Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

gunu_derivatives.h

Go to the documentation of this file.
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_DERIVATIVES_H
00021 #define GUNU_DERIVATIVES_H
00022 
00023 namespace gunu {
00024 
00025 using gul::Ptr;
00026 using gul::point;
00027 using gul::hpoint;
00028 using gul::curve;
00029 using gul::Min;
00030 
00031 /*------------------------------------------------------------------------
00032   Calculate NURBS basis functions and their first 'n' derivatives.
00033   Only the non-vanishing basis functions are calculated (see "The NURBS Book")
00034 ------------------------------------------------------------------------*/  
00035 template< class T >
00036 void CalcDersBasisFuns( 
00037             const T u, const int i, const int p, const int n,
00038             const Ptr< T >& U, Ptr< Ptr< T > >& ders );
00039 
00040 /*-------------------------------------------------------------------------
00041   Calculates the first 'd' derivatives of a curve at a point 'u'. The results
00042   are homogeneous points (like the control points), returned in 'CK[]'
00043   (see "The NURBS Book")
00044 --------------------------------------------------------------------------- */
00045 /*
00046 template< class T, class EP >
00047 GULAPI void BSPCurveDerivatives( 
00048            const T u, const int n, const int p, const gul::Ptr< T >& U,
00049            const gul::Ptr< EP >& Pw, const int d, gul::Ptr< EP >& CK );
00050 */
00051 
00052 /*---------------------------------------------------------------------------
00053   Calculates mixed partial derivatives of a NURBS surface. Let 'k' and 'l' be
00054   the number of derivatives in 'u' and 'v' direction, then all mixed ders with
00055   'k+l <= d' are calculated. They are returned in 'SKL[k][l]'.  
00056   (see "The NURBS Book")
00057 ------------------------------------------------------------------------- */  
00058 template< class T, class EP >
00059 void BSPSurfaceDerivatives(
00060                 const T u, const T v,
00061                 const int nu, const int pu, const Ptr< T >& U,
00062                 const int nv, const int pv, const Ptr< T >& V,
00063                 const Ptr< Ptr< EP > >& Pw,
00064                 const int d, Ptr< Ptr< EP > >& SKL );
00065 
00066 /*-------------------------------------------------------------------------
00067   Calculates the first 'd' partial derivatives of the projection of a NURBS
00068   curve into euclidian space (3-dimensions), so the calculated ders are points
00069   in 3-dimensional space   
00070   (see "The NURBS Book")
00071 ------------------------------------------------------------------------- */  
00072 template< class T, class HP, class EP >
00073 GULAPI void CurveDerivatives(
00074                     const T u, const int n, const int p,
00075                     const Ptr< T >& U, const Ptr< HP >& Pw, const int d,
00076                     Ptr< EP >& CK );        
00077 
00078 // VC currently (VC7) has problems with the ordering of function templates,
00079 // so i cannot use the following, more specialized template 
00080 #ifndef _MSC_VER
00081 template< class T, class EP >
00082 GULAPI void CurveDerivatives(
00083                     const T u, const int n, const int p,
00084                     const Ptr< T >& U, const Ptr<EP>& Pw, const int d,
00085                     Ptr<EP>& CK )  
00086 {
00087   BSPCurveDerivatives(u,n,p,U,Pw,d,CK);
00088 }
00089 #endif
00090 
00091 /*-------------------------------------------------------------------------
00092   Calculates the first 'd' mixed partial derivatives of the projection of a
00093   NURBS surface into euclidian space (3-dimensions), so the calculated ders
00094   are points in 3-dimensional space. They are returned in 'SKL[k][l]'.  
00095   (see "The NURBS Book")
00096 ------------------------------------------------------------------------- */
00097 template< class T, class HP, class EP >          
00098 void SurfaceDerivatives(
00099                 const T u, const T v,
00100                 const int nu, const int pu, const Ptr< T >& U,
00101                 const int nv, const int pv, const Ptr< T >& V,
00102                 const Ptr< Ptr < HP > >& Pw,
00103                 const int d, Ptr< Ptr < EP > >& SKL );
00104 
00105 /*---------------------------------------------------------------------
00106   Calculates the normal vector of a NURBS surface at u=0,v=0
00107 ---------------------------------------------------------------------*/
00108 template< class T, class HP >
00109 void CalcNormal_U0V0( 
00110            const int nu, const int pu, 
00111            const int nv, const int pv,
00112            const Ptr< Ptr< HP > >& Pw, point<T> *Normal );
00113 
00114 /*---------------------------------------------------------------------
00115   Calculates the normal vector of a NURBS surface at u=1,v=0
00116 ---------------------------------------------------------------------*/
00117 template< class T, class HP >
00118 void CalcNormal_U1V0( 
00119            const int nu, const int pu, 
00120            const int nv, const int pv,
00121            const Ptr< Ptr< HP > >& Pw, point<T> *Normal );
00122 
00123 /*---------------------------------------------------------------------
00124   Calculates the normal vector of a NURBS surface at u=0,v=1
00125 ---------------------------------------------------------------------*/
00126 template< class T, class HP >
00127 void CalcNormal_U0V1( 
00128            const int nu, const int pu, 
00129            const int nv, const int pv,
00130            const Ptr< Ptr< HP > >& Pw, point<T> *Normal );
00131 
00132 /*---------------------------------------------------------------------
00133   Calculates the normal vector of a NURBS surface at u=1,v=1
00134 ---------------------------------------------------------------------*/
00135 template< class T, class HP >
00136 void CalcNormal_U1V1( 
00137            const int nu, const int pu, 
00138            const int nv, const int pv,
00139            const Ptr< Ptr< HP > >& Pw, point<T> *Normal );
00140 
00141 }
00142 
00143 #endif

Generated on Mon Jan 21 04:17:37 2002 for GUL 0.6 - Geometry Utility Library by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001