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_KNOT_REMOVAL_H 00021 #define GUNU_KNOT_REMOVAL_H 00022 00023 namespace gunu { 00024 00025 /*------------------------------------------------------------------------- 00026 calc range of parameter indices which fall into the domain of each basis 00027 function 00028 --------------------------------------------------------------------------*/ 00029 00030 template< class T > 00031 GULAPI void CalcParameterRanges( 00032 int n, 00033 int p, 00034 const gul::Ptr<T>& U, 00035 int nP, 00036 const gul::Ptr<T>& P, 00037 gul::Ptr<int>& R, 00038 gul::Ptr<int>& S ); 00039 00040 /*---------------------------------------------------------------------- 00041 Removes (roughly) as many knots as possible from a curve. it returns the 00042 index of the last inner knot of the new knot vector (new 'n'). U,Pw, 00043 and QE are input _and_ output arrays. 00044 -----------------------------------------------------------------------*/ 00045 template< class T, class EP > 00046 GULAPI int RemoveCurveKnots( 00047 int n, 00048 int p, 00049 gul::Ptr<T>& U, 00050 gul::Ptr<EP>& Pw, 00051 int nQ, 00052 const gul::Ptr<T>& QU, 00053 T tol, 00054 gul::Ptr<T>& QE ); 00055 00056 00057 /*----------------------------------------------------------------------- 00058 global curve approximation with error bound 00059 ------------------------------------------------------------------------*/ 00060 template< class T, class EP > 00061 GULAPI bool GlobalCurveApproximationE( 00062 int nQ, 00063 const Ptr<EP>& Q, 00064 T tol, // a bound for the absolute error of the curve 00065 T eps, // a bound for the relative error (needed internally 00066 // for measuring point coincidence and zero cosine) 00067 int degree, 00068 int *ret_n, 00069 Ptr<T> *ret_U, 00070 Ptr<EP> *ret_Pw, 00071 Ptr<T> *ret_QE, // error at each data point 00072 Ptr<T> *ret_QU ); // parameter value of each data point 00073 00074 } 00075 00076 #endif