00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef GUGR_SPLIT_H
00021 #define GUGR_SPLIT_H
00022
00023 namespace gugr {
00024
00025 template< class T >
00026 struct GraphConvInfo
00027 {
00028 T minx;
00029 T miny;
00030 T scale;
00031
00032 guar::rational MinX;
00033 guar::rational MaxX;
00034 guar::rational FarMinX;
00035 guar::rational FarMaxX;
00036 guar::rational MinY;
00037 guar::rational MaxY;
00038 guar::rational FarMinY;
00039 guar::rational FarMaxY;
00040 };
00041
00042 struct GraphInfo
00043 {
00044 gugr::graph_vertex *P[2][2];
00045 int face;
00046
00047 gugr::graph_edge_list E;
00048 gugr::graph_vertex_list V;
00049
00050 ~GraphInfo()
00051 {
00052 E.DeleteElems();
00053 V.DeleteElems();
00054 }
00055 void *operator new( size_t s )
00056 {
00057 size_t dummy;
00058 void *p = gust::PoolAlloc( s, &dummy );
00059 if( p == NULL ) throw gul::PoolAllocError();
00060 return(p);
00061 }
00062 void operator delete( void *p, size_t s )
00063 {
00064 gust::PoolFree( p, s );
00065 }
00066 };
00067 typedef GraphInfo *GraphInfo4[4];
00068
00069
00070
00071
00072
00073
00074
00075
00076 void InsertDiagonal(
00077 graph_edge_list *E, graph_vertex_list *V,
00078 graph_vertex *P11, graph_vertex *P22 );
00079
00080
00081
00082
00083 void IntersectWithHorizontals(
00084 graph_edge_list *E, graph_vertex_list *V,
00085 const int nS, gul::Ptr< cut_info > S );
00086
00087
00088
00089
00090 void DivideHorizontalStrips(
00091 cut_info *Sa, cut_info *Sb, int maxE,
00092 const rational& minx, const rational maxx,
00093 const rational& far_left, const rational& far_right,
00094 graph_vertex **minSaV, graph_vertex **minSbV,
00095 graph_vertex **maxSaV, graph_vertex **maxSbV );
00096
00097
00098
00099
00100 void IntersectWithVerticals(
00101 graph_edge_list *E, graph_vertex_list *V,
00102 const int nS, gul::Ptr< cut_info > S );
00103
00104
00105
00106
00107 void DivideVerticalStrips(
00108 cut_info *Sb, cut_info *Sa, int maxE,
00109 const rational& miny, const rational maxy,
00110 const rational& far_bottom, const rational& far_top,
00111 graph_vertex **minSbV, graph_vertex **minSaV,
00112 graph_vertex **maxSbV, graph_vertex **maxSaV );
00113
00114
00115
00116
00117
00118 template< class T >
00119 void SplitGraph( GraphInfo *G, T xmed, T ymed,
00120 GraphConvInfo<T> *Gconv, GraphInfo4& sub );
00121
00122
00123
00124
00125 template< class T >
00126 void InitGraph(
00127 const rational& X1, const rational& X2,
00128 const rational& Y1, const rational& Y2,
00129 GraphConvInfo<T> *Gconv, graph_edge_list *E, graph_vertex_list *V,
00130 GraphInfo *G );
00131
00132 }
00133
00134 #endif