Project: ArangoDB (App Definition and Development / Database)
File: GTL_boostcon_draft03.pdf

 
 
Lucanus Simonson, Gy uszi Suto

   
 
 
  
   

  
  

   
   

  
    

  
  
    
  
  
     
  
   
    
    
    
  
    
  
  
  
   
  
    
  
 
 

 

 

  

 

  
 
 
  




  
  a c
 b
 d
  
  void clip_and_sub tract(polygon_set & d,
polygon a, polygo n b, rectangle c)  {
d = (a & c) - b;
}
  

  

  

  

  

  

  

  

  

  
 
  

  

  

  
 
 
  

  

  

  
 
 
 
  

  

  

  
 
 
 
  

  

  

  

  
 
 
 
  

  
 
 
  

  

  

  
 
 
 
  

  
 
 
   
 



 



 
 
  
  
  

 
  
  
  
  
  
  





 
 
 
   

  
 
 
   
 
   
 
  

  
  
  

   

   


   


   






   
 
  


  


  

  
 
 
 
  
  


   

  
 
  



  

  
 
 
 
 
   
   
   
   
  

   
  
 

   
  
    

    

   
  

     
  
 
   
   
    
  
  
     
  
 
    
  
   
 
   
 
  
 

  
 
  
 
  
 
 
   
 
   
  
  

  
   

  
   
  
    
 
    
   
    
   
    


   
  
    
  
 
    
   
    
   
 
+1-1 +1
-1-1 +1   

 
  
  
     
    
   
   
    

   
     

     
 
      
  
  
 
 
  
Decompose 
Decompose Merge Input 
Vertices-1 -1
+1 +1
+1 -10,-1
0,+1 0,-10,+1-1,0 +1,0
-1,0 +1,0
+1,0 -1,0-1
+1 -1+1
  
 
 
0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0+1,0
-1,0
   
  

   

    
 
0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0-1
+1+1,0
-1,0
   

   

     
  




0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0+1
-1-1
+1+1,0
-1,0
   

   

    
0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0-1
+1-1
+1
+1,0
-1,0

   

   

     
  
 
0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0+1
-1-1
+1
+1,0
-1,0
+1
-1
   

   

    

    
 
0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0-1
+1
+1,0
-1,0
+2
-1-1 +1
-1+1
-1
   

   

     
 
0,-1
0,+1 0,-10,+1-1,0
+1,0
+1,0 -1,0-1
+1
+1,0
-1,0
+1
-1+1
-1+1
-1
+2
-1-1
  

  
  
 
Sweep-line Polygon 
Formation-1
+1+1
-1+1
-1+1
-1
+2
-1-1 
  
   
  
   
  
  
  
 






 

  


  


 


 
  
  
 
  
 

  

   

  
 
   
 
 
 

 













 
 
 
   
   
       
  

  

  
 

 

  

 


 

  
 

  
 
 
  
 
   

  
 
   

  
 //Segment 1: (x11 ,y11) to (x12, y1 2)
//Segment 2: (x21 ,y21) to (x22, y2 2)
y1 < y2 iff
(x22 - x21)((x - x11)(y12 - y11) +  y11(x12 - x 11))  <
(x12 - x11)((x - x21)(y22 - y21) +  y21(x22 - x 21)) 

  

//Segment 1: (x11 ,y11) to (x12, y1 2)
dx1 = x12 - x11;  dy1 = y12 - y11;
//Segment 2: (x21 ,y21) to (x22, y2 2)
dx2 = x22 - x21;  dy2 = y22 - y21;
x = (x11 * dy1 * dx2 – x21 * dy2 *  dx1 + 
y21 * dx1 * dx2 - y11 * dx1 * dx2) / 
(dy1 * dx2 - dy2 * dx1); 
y = (y11 * dx1 * dy2 - y21 * dx2 *  dy1 + 
x21 * dy1 * dy2 - x11 * dy1 * dy2) / 
(dx1 * dy2 - dx2 * dy1); 
 
 
 

 

 

 

  
  
 



  

 

  

 

  
  
 
  
 
  
 
  
  
   

   
   
  b a a
 result
   
 
   void foo(list<CPo lygon>& result, 
const list<CPolyg on>& a, 
const list<CPolyg on>& b) {
CBoundingBox doma inExtent;
gtl::extents(doma inExtent, a);
result += (b & do mainExtent) ^ (a - 10);
} 
  

   
 
 
 
   
 
   
 
   
 
  
   

template <typenam e T>
struct point_trai ts {
typedef T::coordi nate_type coordin ate_type;
coordinate_type g et(const T& p, or ientation_2d orie nt) { 
return p.get(orie nt);
}
template <typenam e T>
struct point_muta ble_traits {
void set(const T&  p, orientation_2 d orient, 
coordinate_type v alue) {
p.set(orient, val ue);
}
T construct(coord inate_type x, coo rdinate_type y) {  
return T(x, y); }
}; 
   
  
 
    
  

   
 
template <typenam e T> struct is_in teger {};
template <> 
struct is_integer <int> { typedef i nt type; };
template <typenam e T> struct is_fl oat {};
template <> 
struct is_float<f loat> { typedef f loat type; };
template <typenam e T>
typename is_int<T >::type foo(T inp ut);
template <typenam e T>
typename is_float <T>::type foo(T i nput); 
 
 
 
 

   
   
 
   
 
  
   
 
  
struct polygon_co ncept {};
struct rectangle_ concept {};
template <typenam e T>
struct is_a_polyg on_concept{};
template <> struc t is_a_polygon_co ncept<rectangle_c oncept> { 
typedef gtl_yes t ype; }; 
 
  
 
  
 

  

  
 
  
PS polygon_set_conceptPS45 polygon_45_set_conceptPS90 polygon_90_set_conceptPWH polygon_with_holes_conc eptP polygon_conceptPWH45 polygon_45_with_holes_ conceptP45 polygon_45_conceptPWH90 polygon_90_with_holes_ conceptP90 polygon_90_conceptR rectangle_conceptPT3D point_3d_conceptPT point_conceptI interval_conceptC coordinate_conceptAbbreviation Concept
  

  
 
  
 
 
  
 
 
  
 
  
 
  
 
  
   

   
 
   
 

   
 

  




  

 


 
 
 
  
 
 operator=operator-operator&void clip_and_sub tract(polygon_set & d,
polygon a, polygo n b, rectangle c)  {
d = (a & c) - b;
} 
   
  
 
  
   

   
  

  
  
    
  

    

    
  
   
  
 
   

   
  
  
 
  
  
  
 
 
template <typenam e T> struct gtl_i f{
#ifdef WIN32
typedef gtl_no ty pe;
#endif
};
template <> struc t gtl_if<gtl_yes>  { typedef gtl_ye s type; };