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_MBA_APPROXIMATE_H 00021 #define GUNU_MBA_APPROXIMATE_H 00022 00023 namespace gunu { 00024 00025 using gul::Ptr; 00026 using gul::point; 00027 using gul::point1; 00028 using gul::point2; 00029 00030 /*-------------------------------------------------------------------------*//** 00031 BSpline approximation, 00032 calculates the points of a control lattice 'delta', which approximates 00033 data points in 'P'. (P[].z contains the function value, P[].x and P[].y 00034 the location in the domain) */ 00035 /*----------------------------------------------------------------------------*/ 00036 template< class T > 00037 void BAapproximate( 00038 int nP, Ptr< point<T> >& P, 00039 int nu, int pu, Ptr<T>& U, 00040 int nv, int pv, Ptr<T>& V, 00041 Ptr< Ptr< point1<T> > >& delta ); 00042 /*-------------------------------------------------------------------------*//** 00043 BSpline approximation, 00044 calculates the points of a control lattice 'delta', which approximates 00045 data points in 'P'. (P[].z contains the function value, P[].x and P[].y the 00046 location in the domain). An individual standard deviation for each data 00047 point must be given in 'Sigma' */ 00048 /*----------------------------------------------------------------------------*/ 00049 template< class T > 00050 void BAapproximate( 00051 int nP, Ptr< point<T> >& P, Ptr<T>& Sigma, 00052 int nu, int pu, Ptr<T>& U, 00053 int nv, int pv, Ptr<T>& V, 00054 Ptr< Ptr< point1<T> > >& delta ); 00055 00056 /*-------------------------------------------------------------------------*//** 00057 Multilevel BSpline approximation, 00058 Calculates a NURBS surface (one-dimensional), which approximates 00059 data points in 'P', (P[].z contains the function value, P[].x and P[] the 00060 location in the domain). An individual standard deviation for each data 00061 point can be given in 'Sigma'. 00062 (Remarks: the data point array P is changed - after the algorithm the P[].z 00063 contain the difference between the function values of the calculated 00064 surface and and the original value!!!, 00065 Output arrays U,V,Psi must be reserved by the caller: 00066 U: 2*pu + 2^(nIter-1) + 1, 00067 V: 2*pv + 2^(nIter-1) + 1, 00068 Psi: (pv + 2^(nIter-1))*(pu + 2^(nIter-1)) */ 00069 /*----------------------------------------------------------------------------*/ 00070 template< class T > 00071 void MBAapproximate( 00072 int nP, Ptr< point<T> >& P, bool useSigma, Ptr<T>& Sigma, int nIter, 00073 int pu, int pv, Ptr<T>& U, Ptr<T>& V, Ptr< Ptr< point1<T> > >& Psi ); 00074 00075 /*-------------------------------------------------------------------*//** 00076 executes the MBA algorithm and constructs a 3-dimensional surface 00077 from the results (x(),y() are identity mappings). 00078 when 'minimize' is set, the base rectangle in the xy-plane is 00079 chosen so that its area is minimal */ 00080 /* ---------------------------------------------------------------------*/ 00081 template< class T, class HP > 00082 GULAPI void SurfaceOverXYPlane( 00083 int nDatPoints, Ptr< point<T> >& datPoints, 00084 bool useStdDevs, Ptr<T>& StdDevs, 00085 bool minimize, int nIter, 00086 int pu, int pv, 00087 int *ret_nu, Ptr<T> *retU, 00088 int *ret_nv, Ptr<T> *retV, 00089 Ptr< Ptr<HP> > *retPw ); 00090 00091 /*-------------------------------------------------------------------*//** 00092 creates a surface with the MBA algorithm. 'Dat' contains the 3d 00093 values and 'Dom' the locations in the parametric domain 00094 (output arrays are reserved automatically) */ 00095 /* ---------------------------------------------------------------------*/ 00096 template< class T > 00097 GULAPI void MBASurface( int nDat, Ptr< point<T> > Dat, Ptr< point2<T> > Dom, 00098 int nIter, int pu, int pv, 00099 int *ret_nu, Ptr<T> *retU, 00100 int *ret_nv, Ptr<T> *retV, 00101 Ptr< Ptr< point<T> > > *retP ); 00102 00103 00104 } 00105 00106 #endif 00107