/src/geos/include/geos/noding/Octant.h
Line | Count | Source |
1 | | /********************************************************************** |
2 | | * |
3 | | * GEOS - Geometry Engine Open Source |
4 | | * http://geos.osgeo.org |
5 | | * |
6 | | * Copyright (C) 2006 Refractions Research Inc. |
7 | | * |
8 | | * This is free software; you can redistribute and/or modify it under |
9 | | * the terms of the GNU Lesser General Public Licence as published |
10 | | * by the Free Software Foundation. |
11 | | * See the COPYING file for more information. |
12 | | * |
13 | | **********************************************************************/ |
14 | | |
15 | | #pragma once |
16 | | |
17 | | #include <geos/export.h> |
18 | | |
19 | | #include <geos/util.h> |
20 | | |
21 | | // Forward declarations |
22 | | namespace geos { |
23 | | namespace geom { |
24 | | class CoordinateXY; |
25 | | } |
26 | | } |
27 | | |
28 | | namespace geos { |
29 | | namespace noding { // geos.noding |
30 | | |
31 | | /** \brief |
32 | | * Methods for computing and working with octants of the Cartesian plane. |
33 | | * |
34 | | * Octants are numbered as follows: |
35 | | * |
36 | | * 2|1 |
37 | | * 3 | 0 |
38 | | * ---+-- |
39 | | * 4 | 7 |
40 | | * 5|6 |
41 | | * |
42 | | * If line segments lie along a coordinate axis, the octant is the lower of the two |
43 | | * possible values. |
44 | | * |
45 | | * Last port: noding/Octant.java rev. 1.2 (JTS-1.7) |
46 | | */ |
47 | | class GEOS_DLL Octant { |
48 | | private: |
49 | 0 | Octant() {} // Can't instantiate it |
50 | | public: |
51 | | |
52 | | /** |
53 | | * Returns the octant of a directed line segment (specified |
54 | | * as x and y displacements, which cannot both be 0). |
55 | | */ |
56 | | static int octant(double dx, double dy); |
57 | | |
58 | | /** |
59 | | * Returns the octant of a directed line segment from p0 to p1. |
60 | | */ |
61 | | static int octant(const geom::CoordinateXY& p0, const geom::CoordinateXY& p1); |
62 | | |
63 | | static int |
64 | | octant(const geom::CoordinateXY* p0, const geom::CoordinateXY* p1) |
65 | 0 | { |
66 | 0 | ::geos::ignore_unused_variable_warning(p0); |
67 | 0 | return octant(*p0, *p1); |
68 | 0 | } |
69 | | }; |
70 | | |
71 | | |
72 | | } // namespace geos.noding |
73 | | } // namespace geos |