GEOS  3.13.0dev
HCoordinate.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2011 Sandro Santilli <strk@kbt.io>
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: algorithm/HCoordinate.java r386 (JTS-1.12+)
18  *
19  **********************************************************************/
20 
21 #pragma once
22 
23 #include <geos/export.h>
24 #include <iosfwd>
25 
26 // Forward declarations
27 namespace geos {
28 namespace geom {
29 class Coordinate;
30 }
31 }
32 
33 namespace geos {
34 namespace algorithm { // geos::algorithm
35 
36 
43 class GEOS_DLL HCoordinate {
44 
45 public:
46 
47  friend std::ostream& operator<< (std::ostream& o, const HCoordinate& c);
48 
59  static void intersection(const geom::Coordinate& p1,
60  const geom::Coordinate& p2,
61  const geom::Coordinate& q1,
62  const geom::Coordinate& q2,
63  geom::Coordinate& ret);
64 
65  double x, y, w;
66 
67  HCoordinate();
68 
69  HCoordinate(double _x, double _y, double _w);
70 
71  HCoordinate(const geom::Coordinate& p);
72 
82 
83  HCoordinate(const geom::Coordinate& p1, const geom::Coordinate& p2,
84  const geom::Coordinate& q1, const geom::Coordinate& q2);
85 
86  HCoordinate(const HCoordinate& p1, const HCoordinate& p2);
87 
88  double getX() const;
89 
90  double getY() const;
91 
92  void getCoordinate(geom::Coordinate& ret) const;
93 
94 };
95 
96 std::ostream& operator<< (std::ostream& o, const HCoordinate& c);
97 
98 } // namespace geos::algorithm
99 } // namespace geos
100 
Represents a homogeneous coordinate in a 2-D coordinate space.
Definition: HCoordinate.h:43
HCoordinate(const geom::Coordinate &p1, const geom::Coordinate &p2)
Constructs a homogeneous coordinate which is the intersection of the lines define by the homogenous c...
static void intersection(const geom::Coordinate &p1, const geom::Coordinate &p2, const geom::Coordinate &q1, const geom::Coordinate &q2, geom::Coordinate &ret)
Computes the (approximate) intersection point between two line segments using homogeneous coordinates...
Coordinate is the lightweight class used to store coordinates.
Definition: Coordinate.h:216
Basic namespace for all GEOS functionalities.
Definition: Angle.h:25