00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00037
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(
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
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
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
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
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 }
00174
00175 #endif
00176