GEOS 3.8.1
CGAlgorithmsDD.h
Go to the documentation of this file.
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2014 Mateusz Loskot <mateusz@loskot.net>
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 * Last port: algorithm/CGAlgorithmsDD.java r789 (JTS-1.14)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_ALGORITHM_CGALGORITHMDD_H
20#define GEOS_ALGORITHM_CGALGORITHMDD_H
21#include <geos/export.h>
22#include <geos/algorithm/ttmath/ttmath.h>
23
25
29typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(128)> DD;
30//typedef ttmath::Big<TTMATH_BITS(64), TTMATH_BITS(128)> DD;
31//typedef ttmath::Big<TTMATH_BITS(32), TTMATH_BITS(256)> DD;
32//typedef ttmath::Big<TTMATH_BITS(64), TTMATH_BITS(256)> DD;
33
34// Forward declarations
35namespace geos {
36namespace geom {
37class Coordinate;
38class CoordinateSequence;
39}
40}
41
42namespace geos {
43namespace algorithm { // geos::algorithm
44
46class GEOS_DLL CGAlgorithmsDD {
47
48public:
49
50 enum {
51 CLOCKWISE = -1,
52 COLLINEAR = 0,
53 COUNTERCLOCKWISE = 1
54 };
55
56 enum {
57 RIGHT = -1,
58 LEFT = 1,
59 STRAIGHT = 0,
60 FAILURE = 2
61 };
62
75 static int orientationIndex(const geom::Coordinate& p1,
76 const geom::Coordinate& p2,
77 const geom::Coordinate& q);
99 const geom::Coordinate& pb,
100 const geom::Coordinate& pc);
101
102 static int
103 orientation(double x)
104 {
105 if(x < 0) {
106 return CGAlgorithmsDD::RIGHT;
107 }
108 if(x > 0) {
109 return CGAlgorithmsDD::LEFT;
110 }
111 return CGAlgorithmsDD::STRAIGHT;
112 }
113
124 const geom::Coordinate& q1, const geom::Coordinate& q2);
125
126 static int signOfDet2x2(double dx1, double dy1, double dx2, double dy2);
127
128 static DD detDD(double x1, double y1, double x2, double y2);
129 static DD detDD(const DD& x1, const DD& y1, const DD& x2, const DD& y2);
130
155
156protected:
157
158 static int signOfDet2x2(const DD& x1, const DD& y1, const DD& x2, const DD& y2);
159
160};
161
162} // namespace geos::algorithm
163} // namespace geos
164
165#endif // GEOS_ALGORITHM_CGALGORITHM_H
ttmath::Big< TTMATH_BITS(32), TTMATH_BITS(128)> DD
Close to DoubleDouble equivalent used by JTS.
Definition: CGAlgorithmsDD.h:29
Implements basic computational geometry algorithms using extended precision float-point arithmetic.
Definition: CGAlgorithmsDD.h:46
static geom::Coordinate circumcentreDD(const geom::Coordinate &a, const geom::Coordinate &b, const geom::Coordinate &c)
Computes the circumcentre of a triangle.
static geom::Coordinate intersection(const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q1, const geom::Coordinate &q2)
static int orientationIndex(const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q)
Returns the index of the direction of the point q relative to a vector specified by p1-p2.
static int orientationIndexFilter(const geom::Coordinate &pa, const geom::Coordinate &pb, const geom::Coordinate &pc)
A filter for computing the orientation index of three coordinates.
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:60
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25