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

gugr_split.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 GUGR_SPLIT_H
00021 #define GUGR_SPLIT_H
00022 
00023 namespace gugr {
00024 
00025 template< class T >
00026 struct GraphConvInfo
00027 {
00028   T minx;    // normalization parameters
00029   T miny;
00030   T scale;
00031   
00032   guar::rational MinX;      // point to the left of all points
00033   guar::rational MaxX;
00034   guar::rational FarMinX;   // point far to the left 
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   Special utility function, used in the tesselation of nurbs surfaces.
00072   It inserts the diagonal of a tesselation quad into the graph for this
00073   quad. It is assumed that width and height of quad are equal, i.e.
00074   x2-x1 = y2-y1
00075 ----------------------------------------------------------------------*/
00076 void InsertDiagonal( 
00077               graph_edge_list *E, graph_vertex_list *V,
00078               graph_vertex *P11, graph_vertex *P22 );
00079 
00080 /* -------------------------------------------------------------------------
00081   Calculates the intersection of a graph with horizontal cutting lines 
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   Divide graph into an independant upper and lower part
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   Calculates the intersection of a graph with vertical cutting lines 
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   Divide graph into an independant left and right part
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   splits a graph into four independent parts
00117 ---------------------------------------------------------------------------- */
00118 template< class T >
00119 void SplitGraph( GraphInfo *G, T xmed, T ymed,
00120                  GraphConvInfo<T> *Gconv, GraphInfo4& sub );
00121 
00122 /* ---------------------------------------------------------------------------
00123   inits a graph info
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

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