BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Segment_Delaunay_graph_2/Arrangement_enum.h
Go to the documentation of this file.
00001 // Copyright (c) 2003,2004,2005,2006  INRIA Sophia-Antipolis (France) and
00002 // Notre Dame University (U.S.A.).  All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00005 // the terms of the Q Public License version 1.0.
00006 // See the file LICENSE.QPL distributed with CGAL.
00007 //
00008 // Licensees holding a valid commercial license may use this file in
00009 // accordance with the commercial license agreement provided with the software.
00010 //
00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 //
00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Segment_Delaunay_graph_2/include/CGAL/Segment_Delaunay_graph_2/Arrangement_enum.h $
00015 // $Id: Arrangement_enum.h 40832 2007-11-08 00:27:20Z ameyer $
00016 // 
00017 //
00018 // Author(s)     : Menelaos Karavelas <mkaravel@cse.nd.edu>
00019 
00020 
00021 #ifndef CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARRANGEMENT_ENUM_H
00022 #define CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARRANGEMENT_ENUM_H
00023 
00024 #include <CGAL/Segment_Delaunay_graph_2/basic.h>
00025 #include <iostream>
00026 
00027 
00028 CGAL_BEGIN_NAMESPACE
00029 
00030 CGAL_SEGMENT_DELAUNAY_GRAPH_2_BEGIN_NAMESPACE
00031 
00032 namespace Internal {
00033   struct Arrangement_enum {
00034     enum Arrangement_type {
00035       DISJOINT = 0, // obvious
00036       TOUCH_1, // (p1,p2) and q, and p1 and q are identical
00037       TOUCH_2, // (p1,p2) and q, and p2 and q are identical
00038       TOUCH_11, // (p1,p2), (q1,q2), and p1, q1 are identical
00039       TOUCH_12, // (p1,p2), (q1,q2), and p1, q2 are identical
00040       TOUCH_21, // (p1,p2), (q1,q2), and p2, q1 are identical
00041       TOUCH_22, // (p1,p2), (q1,q2), and p2, q2 are identical
00042       CROSSING, // two segments intersecting at interior points
00043       IDENTICAL, // either two segments or two points that are identical
00044       INTERIOR_1, // (p1,p2) and (q1,q2), and q1, q2 are interior
00045                   // points of (p1,p2)
00046       INTERIOR_2, // (p1,p2) and (q1,q2), and p1, p2 are interior
00047                   // points of (q1,q2)
00048       INTERIOR,  // (p1,p2) and q, and q is an interior point of (p1,p2)
00049       TOUCH_11_INTERIOR_1, // (p1,p2) and (q1,q2), and p1, q1 are
00050                            // identical and q2 is an interior point of (p1,p2)
00051       TOUCH_11_INTERIOR_2, // (p1,p2) and (q1,q2), and p1, q1 are
00052                            // identical and p2 is an interior point of
00053                            // (q1,q2)
00054       TOUCH_12_INTERIOR_1, // (p1,p2) and (q1,q2), and p1, q2 are
00055                            // identical and q1 is an interior point of (p1,p2)
00056       TOUCH_12_INTERIOR_2, // (p1,p2) and (q1,q2), and p1, q2 are
00057                            // identical and p2 is an interior point of (q1,q2)
00058       TOUCH_21_INTERIOR_1, // (p1,p2) and (q1,q2), and p2, q1 are
00059                            // identical and q2 is an interior point of (p1,p2)
00060       TOUCH_21_INTERIOR_2, // (p1,p2) and (q1,q2), and p2, q1 are
00061                            // identical and p1 is an interior point of (q1,q2)
00062       TOUCH_22_INTERIOR_1, // (p1,p2) and (q1,q2), and p2, q2 are
00063                            // identical and q1 is an interior point of (p1,p2)
00064       TOUCH_22_INTERIOR_2, // (p1,p2) and (q1,q2), and p2, q2 are
00065                            // identical and p1 is an interior point of (q1,q2)
00066       OVERLAPPING_11, // (p1,p2) and (q1,q2), and (p1,q1) is the overlap
00067       OVERLAPPING_12, // (p1,p2) and (q1,q2), and (p1,q1) is the overlap
00068       OVERLAPPING_21, // (p1,p2) and (q1,q2), and (p2,q1) is the overlap
00069       OVERLAPPING_22, // (p1,p2) and (q1,q2), and (p2,q2) is the overlap
00070       TOUCH_INTERIOR_12, // (p1,p2) and (q1,q2) and p1 is an interior
00071                          //  point of (q1,q2)
00072       TOUCH_INTERIOR_22, // (p1,p2) and (q1,q2) and p2 is an interior
00073                          //  point of (q1,q2)
00074       TOUCH_INTERIOR_11, // (p1,p2) and (q1,q2) and q1 is an interior
00075                          //  point of (p1,p2)
00076       TOUCH_INTERIOR_21  // (p1,p2) and (q1,q2) and q2 is an interior
00077                          //  point of (p1,p2)
00078     };
00079 
00080 
00081     static Arrangement_type opposite(const Arrangement_type& at) {
00082       // this returns the result if we swap the order of the arguments...
00083       if ( at == TOUCH_12 ) {
00084         return TOUCH_21;
00085       } else if ( at == TOUCH_21 ) {
00086         return TOUCH_12;
00087       } else if ( at == INTERIOR_1 ) {
00088         return INTERIOR_2;
00089       } else if ( at == INTERIOR_2 ) {
00090         return INTERIOR_1;
00091       } else if ( at == TOUCH_11_INTERIOR_1 ) {
00092         return TOUCH_11_INTERIOR_2;
00093       } else if ( at == TOUCH_11_INTERIOR_2 ) {
00094         return TOUCH_11_INTERIOR_1;
00095       } else if ( at == TOUCH_12_INTERIOR_1 ) {
00096         return TOUCH_21_INTERIOR_2;
00097       } else if ( at == TOUCH_12_INTERIOR_2 ) {
00098         return TOUCH_21_INTERIOR_1;
00099       } else if ( at == TOUCH_21_INTERIOR_1 ) {
00100         return TOUCH_12_INTERIOR_2;
00101       } else if ( at == TOUCH_21_INTERIOR_2 ) {
00102         return TOUCH_12_INTERIOR_1;
00103       } else if ( at == TOUCH_22_INTERIOR_1 ) {
00104         return TOUCH_22_INTERIOR_2;
00105       } else if ( at == TOUCH_22_INTERIOR_2 ) {
00106         return TOUCH_22_INTERIOR_1;
00107       } else if ( at == OVERLAPPING_12 ) {
00108         return OVERLAPPING_21;
00109       } else if ( at == OVERLAPPING_21 ) {
00110         return OVERLAPPING_12;
00111       } else if ( at == TOUCH_INTERIOR_12 ) {
00112         return TOUCH_INTERIOR_11;
00113       } else if ( at == TOUCH_INTERIOR_22 ) {
00114         return TOUCH_INTERIOR_21;
00115       } else if ( at == TOUCH_INTERIOR_11 ) {
00116         return TOUCH_INTERIOR_12;
00117       } else if ( at == TOUCH_INTERIOR_21 ) {
00118         return TOUCH_INTERIOR_22;
00119       }
00120       return at;
00121     }
00122   };
00123 
00124 #ifdef CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARRANGEMENT_TYPE_OUTPUT_OPERATOR
00125   static
00126   std::ostream& operator<<(std::ostream& os,
00127                            const Arrangement_enum::Arrangement_type& at)
00128   {
00129     typedef Arrangement_enum AT;
00130 
00131     if ( at == AT::DISJOINT ) {
00132       os << "DISJOINT";
00133     } else if ( at == AT::TOUCH_1 ) {
00134       os << "TOUCH_1";
00135     } else if ( at == AT::TOUCH_2 ) {
00136       os << "TOUCH_2";
00137     } else if ( at == AT::TOUCH_11 ) {
00138       os << "TOUCH_11";
00139     } else if ( at == AT::TOUCH_12 ) {
00140       os << "TOUCH_12";
00141     } else if ( at == AT::TOUCH_21 ) {
00142       os << "TOUCH_21";
00143     } else if ( at == AT::TOUCH_22 ) {
00144       os << "TOUCH_22";
00145     } else if ( at == AT::CROSSING ) {
00146       os << "CROSSING";
00147     } else if ( at == AT::IDENTICAL) {
00148       os << "IDENTICAL";
00149     } else if ( at == AT::INTERIOR_1 ) {
00150       os << "INTERIOR_1";
00151     } else if ( at == AT::INTERIOR_2 ) {
00152       os << "INTERIOR_2";
00153     } else if ( at == AT::INTERIOR ) {
00154       os << "INTERIOR";
00155     } else if ( at == AT::TOUCH_11_INTERIOR_1 ) {
00156       os << "TOUCH_11_INTERIOR_1";
00157     } else if ( at == AT::TOUCH_11_INTERIOR_2 ) {
00158       os << "TOUCH_11_INTERIOR_2";
00159     } else if ( at == AT::TOUCH_12_INTERIOR_1 ) {
00160       os << "TOUCH_12_INTERIOR_1";
00161     } else if ( at == AT::TOUCH_12_INTERIOR_2 ) {
00162       os << "TOUCH_12_INTERIOR_2";
00163     } else if ( at == AT::TOUCH_21_INTERIOR_1 ) {
00164       os << "TOUCH_21_INTERIOR_1";
00165     } else if ( at == AT::TOUCH_21_INTERIOR_2 ) {
00166       os << "TOUCH_21_INTERIOR_2";
00167     } else if ( at == AT::TOUCH_22_INTERIOR_1 ) {
00168       os << "TOUCH_22_INTERIOR_1";
00169     } else if ( at == AT::TOUCH_22_INTERIOR_2 ) {
00170       os << "TOUCH_22_INTERIOR_2";
00171     } else if ( at == AT::OVERLAPPING_11 ) {
00172       os << "OVERLAPPING_11";
00173     } else if ( at == AT::OVERLAPPING_12 ) {
00174       os << "OVERLAPPING_12";
00175     } else if ( at == AT::OVERLAPPING_21 ) {
00176       os << "OVERLAPPING_21";
00177     } else if ( at == AT::OVERLAPPING_22 ) {
00178       os << "OVERLAPPING_22";
00179     } else if ( at == AT::TOUCH_INTERIOR_11 ) {
00180       os << "TOUCH_INTERIOR_11";
00181     } else if ( at == AT::TOUCH_INTERIOR_12 ) {
00182       os << "TOUCH_INTERIOR_12";
00183     } else if ( at == AT::TOUCH_INTERIOR_21 ) {
00184       os << "TOUCH_INTERIOR_21";
00185     } else if ( at == AT::TOUCH_INTERIOR_22 ) {
00186       os << "TOUCH_INTERIOR_22";
00187     } else {
00188       CGAL_error();
00189     }
00190 
00191     return os;
00192   }
00193 #endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARRANGEMENT_TYPE_OUTPUT_OPERATOR
00194 
00195 } // namespace Internal
00196 
00197 
00198 CGAL_SEGMENT_DELAUNAY_GRAPH_2_END_NAMESPACE
00199 
00200 CGAL_END_NAMESPACE
00201 
00202 #endif // CGAL_SEGMENT_DELAUNAY_GRAPH_2_ARRANGEMENT_ENUM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines