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

gunu_tesselate.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_TESSELATE_H
00021 #define GUNU_TESSELATE_H
00022 
00023 namespace gunu {
00024 
00025 using gul::Ptr;
00026 using gul::rtr;
00027 using gul::point;
00028 using gul::point2;
00029 using gul::hpoint;
00030 using gul::hpoint2;
00031 using gul::line2;
00032 using gul::cross_product;
00033 using gul::euclid;
00034 
00035 /*-------------------------------------------------------------------------
00036   approximate trimmed NURBS surface with triangles, another user interface
00037   function
00038 -------------------------------------------------------------------------*/
00039 template< class T >
00040 struct TessCbData
00041 {
00042   bool                       need_normals : 1;
00043 
00044   void (*quadfunc)( void *, 
00045         const point<T> *, const point<T> *, const point<T> *, const point<T> *,
00046         const point<T> *, const point<T> *, const point<T> *, const point<T> *,
00047         const T *, const T *, const T *, const T * );
00048   void (*trifunc)( void *, 
00049                    const point<T> *, const point<T> *, const point<T> *,
00050                    const point<T> *, const point<T> *, const point<T> *,
00051                    const point2<T> *, const point2<T> *, const point2<T> * );
00052   void *usrdata;  
00053 
00054   TessCbData(                              /* --- constructor --- */
00055     bool    normal_flag,
00056     void (*a_quadfunc)( void *, 
00057         const point<T> *, const point<T> *, const point<T> *, const point<T> *,
00058         const point<T> *, const point<T> *, const point<T> *, const point<T> *,
00059         const T *, const T *, const T *, const T * ),
00060 
00061     void (*a_trifunc)( void *, 
00062                    const point<T> *, const point<T> *, const point<T> *,
00063                    const point<T> *, const point<T> *, const point<T> *,
00064                    const point2<T> *, const point2<T> *, const point2<T> * ),
00065          void *a_usrdata )
00066   {
00067     need_normals = normal_flag;
00068     quadfunc = a_quadfunc;
00069     trifunc = a_trifunc;
00070     usrdata = a_usrdata;
00071   }
00072 };
00073 
00074 /*-------------------------------------------------------------------
00075   approximate trimmed NURBS surface with triangles
00076 --------------------------------------------------------------------*/
00077 template< class T, class HP >
00078 void _DoLinearizeTrimmedSurface( 
00079        int current_iter, int max_iter,
00080        TessInfo<T,HP> *A,
00081        gugr::GraphInfo *G, gugr::GraphConvInfo<T> *Gconv,
00082        const T tol,
00083        void outfunc1( TessInfo<T,HP> *, void * ),                                   
00084        void outfunc2( TessInfo<T,HP> *, gugr::GraphInfo *, gugr::GraphConvInfo<T> *, 
00085                       void * ),
00086        void *usrdata );
00087             
00088 /*-------------------------------------------------------------------
00089   approximate trimmed NURBS surface with triangles
00090 --------------------------------------------------------------------*/
00091 template< class T, class HP >
00092 GULAPI void DoLinearizeTrimmedSurface( 
00093             int max_iter,
00094             const int nu, const int pu, Ptr< T >& KnotsU,
00095             const int nv, const int pv, Ptr< T >& KnotsV,
00096             Ptr< Ptr< HP > >& Pw,
00097             const T tol,
00098             Ptr< Ptr< point2<T> > >& contour,
00099             void (*outfunc1)( TessInfo<T,HP> *, void * ),                                  
00100             void (*outfunc2)( TessInfo<T,HP> *, gugr::GraphInfo *, 
00101                               gugr::GraphConvInfo<T> *, void * ),
00102             void *usrdata );
00103 
00104 
00105 template< class T, class HP >
00106 GULAPI void TessQuadCb( TessInfo<T,HP> *A, void *usrdata );
00107 
00108 template< class T, class HP >
00109 GULAPI void TessTriCb( TessInfo<T,HP> *, gugr::GraphInfo *, 
00110                        gugr::GraphConvInfo<T> *, void * );
00111 
00112 /*-------------------------------------------------------------------------
00113   another user interface function with other callbacks
00114 -------------------------------------------------------------------------*/
00115 
00116 template< class T, class HP, class EP, class DP >
00117 void LinearizeTrimmedSurface( 
00118             int max_iter,
00119             const int nu, const int pu, Ptr< T >& KnotsU,
00120             const int nv, const int pv, Ptr< T >& KnotsV,
00121             Ptr< Ptr < HP > >& Pw,
00122             const T tol,
00123             Ptr< Ptr< DP > >& contour,
00124             bool normal_flag,
00125             void (*quadfunc)( void *, 
00126                    const EP *, const EP *, const EP *, const EP *,
00127                    const EP *, const EP *, const EP *, const EP *,
00128                    const T *, const T *, const T *, const T * ),
00129             void (*trifunc)( void *, 
00130                    const EP *, const EP *, const EP *,
00131                    const EP *, const EP *, const EP *,
00132                    const DP *, const DP *, const DP * ),
00133             void *usrdata )
00134 {
00135   TessCbData<T> Cb(normal_flag,quadfunc,trifunc,usrdata);
00136 
00137   DoLinearizeTrimmedSurface( 
00138                       max_iter,nu,pu,KnotsU,nv,pv,KnotsV,Pw,tol,contour,
00139                       TessQuadCb<T,HP>,TessTriCb<T,HP>,(void *)&Cb );
00140 }
00141 
00142 /*
00143 template< class T, class HP, class EP >
00144 class Linearize
00145 {
00146 public:
00147   static void TessQuadCb( TessInfo<T,HP> *A, void *usrdata );
00148 
00149   static void TessTriCb( TessInfo<T,HP> *, gugr::GraphInfo *, 
00150                          gugr::GraphConvInfo<T> *, void * );
00151 
00152   GULAPI static void LinearizeSurfaceX( 
00153             int max_iter,
00154             const int nu, const int pu, Ptr< T >& KnotsU,
00155             const int nv, const int pv, Ptr< T >& KnotsV,
00156             Ptr< Ptr < HP > >& Pw,
00157             const T tol, const rtl<T>& t,
00158             Ptr< Ptr< point2<T> > >& contour,
00159             bool normal_flag,
00160             void (*quadfunc)( void *, 
00161                    const EP *, const EP *, const EP *, const EP *,
00162                    const EP *, const EP *, const EP *, const EP *,
00163                    const T *, const T *, const T *, const T * ),
00164             void (*trifunc)( void *, 
00165                    const EP *, const EP *, const EP *,
00166                    const EP *, const EP *, const EP *,
00167                    const point2<T> *, const point2<T> *, const point2<T> * ),
00168             void *usrdata );
00169 
00170 };
00171 */
00172 
00173 }
00174 
00175 #endif
00176 

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