GEOS  3.9.0dev
Quadrant.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions Inc.
8  *
9  * This is free software; you can redistribute and/or modify it under
10  * the terms of the GNU Lesser General Public Licence as published
11  * by the Free Software Foundation.
12  * See the COPYING file for more information.
13  *
14  **********************************************************************
15  *
16  * Last port: geom/Quadrant.java rev. 1.8 (JTS-1.10)
17  *
18  **********************************************************************/
19 
20 
21 #ifndef GEOS_GEOM_QUADRANT_H
22 #define GEOS_GEOM_QUADRANT_H
23 
24 #include <geos/export.h>
25 #include <string>
26 
27 #include <geos/inline.h>
28 
29 // Forward declarations
30 namespace geos {
31 namespace geom {
32 class Coordinate;
33 }
34 }
35 
36 namespace geos {
37 namespace geom { // geos.geom
38 
50 class GEOS_DLL Quadrant {
51 
52 public:
53 
54  static const int NE = 0;
55  static const int NW = 1;
56  static const int SW = 2;
57  static const int SE = 3;
58 
65  static int quadrant(double dx, double dy);
66 
72  static int quadrant(const geom::Coordinate& p0,
73  const geom::Coordinate& p1);
74 
78  static bool isOpposite(int quad1, int quad2);
79 
80  /*
81  * Returns the right-hand quadrant of the halfplane defined by
82  * the two quadrants,
83  * or -1 if the quadrants are opposite, or the quadrant if they
84  * are identical.
85  */
86  static int commonHalfPlane(int quad1, int quad2);
87 
92  static bool isInHalfPlane(int quad, int halfPlane);
93 
97  static bool isNorthern(int quad);
98 };
99 
100 
101 } // namespace geos.geom
102 } // namespace geos
103 
104 #ifdef GEOS_INLINE
105 # include "geos/geom/Quadrant.inl"
106 #endif
107 
108 #endif // ifndef GEOS_GEOM_QUADRANT_H
109 
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:26
Utility functions for working with quadrants.
Definition: Quadrant.h:50