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_BEZIER_DERIVATIVES_H 00021 #define GUNU_BEZIER_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 The following functions are just simplifications for Bezier functions. 00033 The only difference to the corresponding Nurbs functions is, that 00034 the knot span searching is missing, since Bezier knot vectors have 00035 only one knot span 00036 *************************************************************************/ 00037 00038 /*------------------------------------------------------------------------- 00039 Calculates the first 'd' derivatives of a curve at a point 'u'. The results 00040 are homogeneous points (like the control points), returned in 'CK[]' 00041 (see "The NURBS Book") 00042 --------------------------------------------------------------------------- */ 00043 template< class T, class EP > 00044 void BezierBSPCurveDerivatives( 00045 const T u, const int p, const Ptr< T >& U, 00046 const Ptr< EP >& Pw, const int d, EP *CK ); 00047 00048 /*--------------------------------------------------------------------------- 00049 Calculates mixed partial derivatives of a NURBS surface. Let 'k' and 'l' be 00050 the number of derivatives in 'u' and 'v' direction, then all mixed ders with 00051 'k+l <= d' are calculated. They are returned in 'SKL[k][l]'. 00052 (see "The NURBS Book") 00053 ------------------------------------------------------------------------- */ 00054 template< class T, class EP > 00055 void BezierBSPSurfaceDerivatives( 00056 const T u, const T v, 00057 const int pu, const Ptr< T >& U, 00058 const int pv, const Ptr< T >& V, 00059 const Ptr< Ptr< EP > >& Pw, 00060 const int d, Ptr< Ptr< EP > >& SKL ); 00061 00062 /*------------------------------------------------------------------------- 00063 Calculates the first 'd' partial derivatives of the projection of a NURBS 00064 curve into euclidian space (3-dimensions), so the calculated ders are points 00065 in 3-dimensional space 00066 (see "The NURBS Book") 00067 ------------------------------------------------------------------------- */ 00068 template< class T, class HP, class EP > 00069 void BezierCurveDerivatives( 00070 const T u, const int p, 00071 const Ptr< T >& U, const Ptr< HP >& Pw, const int d, 00072 EP *CK ); 00073 00074 /*------------------------------------------------------------------------- 00075 Calculates the first 'd' mixed partial derivatives of the projection of a 00076 NURBS surface into euclidian space (3-dimensions), so the calculated ders 00077 are points in 3-dimensional space. They are returned in 'SKL[k][l]'. 00078 (see "The NURBS Book") 00079 ------------------------------------------------------------------------- */ 00080 00081 #ifndef _MSC_VER 00082 template< class T, class EP > 00083 void BezierSurfaceDerivatives( 00084 const T u, const T v, 00085 const int pu, const Ptr< T >& U, 00086 const int pv, const Ptr< T >& V, 00087 const Ptr< Ptr < EP > >& Pw, 00088 const int d, Ptr< Ptr < EP > >& SKL ) 00089 { 00090 BezierBSPSurfaceDerivatives<T,EP>( u, v, pu, U, pv, V, Pw, d, SKL ); 00091 } 00092 #endif 00093 00094 template< class T, class HP, class EP > 00095 void BezierSurfaceDerivatives( 00096 const T u, const T v, 00097 const int pu, const Ptr< T >& U, 00098 const int pv, const Ptr< T >& V, 00099 const Ptr< Ptr < HP > >& Pw, 00100 const int d, Ptr< Ptr < EP > >& SKL ); 00101 00102 } 00103 00104 #endif