GEOS  3.4.2
Quadrant.h
00001 /**********************************************************************
00002  *
00003  * GEOS - Geometry Engine Open Source
00004  * http://geos.osgeo.org
00005  *
00006  * Copyright (C) 2005-2006 Refractions Research Inc.
00007  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Public Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: geomgraph/Quadrant.java rev. 1.8 (JTS-1.10)
00017  *
00018  **********************************************************************/
00019 
00020 
00021 #ifndef GEOS_GEOMGRAPH_QUADRANT_H
00022 #define GEOS_GEOMGRAPH_QUADRANT_H
00023 
00024 #include <geos/export.h>
00025 #include <string>
00026 
00027 #include <geos/inline.h>
00028 
00029 // Forward declarations
00030 namespace geos {
00031         namespace geom {
00032                 class Coordinate;
00033         }
00034 }
00035 
00036 namespace geos {
00037 namespace geomgraph { // geos.geomgraph
00038 
00048 class GEOS_DLL Quadrant {
00049 
00050 public:
00051 
00052         static const int NE = 0;
00053         static const int NW = 1;
00054         static const int SW = 2;
00055         static const int SE = 3;
00056 
00063         static int quadrant(double dx, double dy);
00064 
00070         static int quadrant(const geom::Coordinate& p0,
00071                             const geom::Coordinate& p1);
00072 
00076         static bool isOpposite(int quad1, int quad2);
00077 
00078         /* 
00079          * Returns the right-hand quadrant of the halfplane defined by
00080          * the two quadrants,
00081          * or -1 if the quadrants are opposite, or the quadrant if they
00082          * are identical.
00083          */
00084         static int commonHalfPlane(int quad1, int quad2);
00085 
00090         static bool isInHalfPlane(int quad, int halfPlane);
00091 
00095         static bool isNorthern(int quad);
00096 };
00097 
00098 
00099 } // namespace geos.geomgraph
00100 } // namespace geos
00101 
00102 #endif // ifndef GEOS_GEOMGRAPH_QUADRANT_H
00103