HalfEdge.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2020 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <string>
#include <cassert>
#include <geos/geom/Coordinate.h>
namespace geos {
namespace edgegraph { // geos.edgegraph
class GEOS_DLL HalfEdge {
private:
/* members */
geom::CoordinateXYZM m_orig;
HalfEdge* m_sym;
HalfEdge* m_next;
void setSym(HalfEdge* e) { m_sym = e; };
HalfEdge* insertionEdge(HalfEdge* eAdd);
void insertAfter(HalfEdge* e);
const HalfEdge* findLowest() const;
protected:
virtual const geom::CoordinateXYZM& directionPt() const { return dest(); };
public:
HalfEdge(const geom::CoordinateXYZM& p_orig) :
m_orig(p_orig)
{};
virtual ~HalfEdge() {};
static HalfEdge* create(const geom::CoordinateXYZM& p0, const geom::CoordinateXYZM& p1);
void link(HalfEdge* p_sym);
const geom::CoordinateXYZM& orig() const { return m_orig; };
const geom::CoordinateXYZM& dest() const { return m_sym->m_orig; }
double directionX() const { return directionPt().x - m_orig.x; }
double directionY() const { return directionPt().y - m_orig.y; }
HalfEdge* sym() const { return m_sym; };
HalfEdge* next() const { return m_next; };
HalfEdge* prev() const;
HalfEdge* oNext() const { return m_sym->m_next; };
void setNext(HalfEdge* e) { m_next = e; };
HalfEdge* find(const geom::CoordinateXY& dest);
bool equals(const geom::CoordinateXY& p0, const geom::CoordinateXY& p1) const;
void insert(HalfEdge* eAdd);
bool isEdgesSorted() const;
int compareAngularDirection(const HalfEdge* e) const;
int compareTo(const HalfEdge* e) const { return compareAngularDirection(e); };
int degree();
HalfEdge* prevNode();
friend std::ostream& operator<< (std::ostream& os, const HalfEdge& el);
static void toStringNode(const HalfEdge* he, std::ostream& os);
};
} // namespace geos.edgegraph
} // namespace geos
geos::edgegraph::HalfEdge
Definition HalfEdge.h:56
geos::edgegraph::HalfEdge::find
HalfEdge * find(const geom::CoordinateXY &dest)
geos::edgegraph::HalfEdge::degree
int degree()
geos::edgegraph::HalfEdge::oNext
HalfEdge * oNext() const
Definition HalfEdge.h:211
geos::edgegraph::HalfEdge::directionPt
virtual const geom::CoordinateXYZM & directionPt() const
Definition HalfEdge.h:112
geos::edgegraph::HalfEdge::orig
const geom::CoordinateXYZM & orig() const
Definition HalfEdge.h:150
geos::edgegraph::HalfEdge::equals
bool equals(const geom::CoordinateXY &p0, const geom::CoordinateXY &p1) const
geos::edgegraph::HalfEdge::directionX
double directionX() const
Definition HalfEdge.h:164
geos::edgegraph::HalfEdge::HalfEdge
HalfEdge(const geom::CoordinateXYZM &p_orig)
Definition HalfEdge.h:122
geos::edgegraph::HalfEdge::compareAngularDirection
int compareAngularDirection(const HalfEdge *e) const
geos::edgegraph::HalfEdge::create
static HalfEdge * create(const geom::CoordinateXYZM &p0, const geom::CoordinateXYZM &p1)
geos::edgegraph::HalfEdge::sym
HalfEdge * sym() const
Definition HalfEdge.h:178
geos::edgegraph::HalfEdge::setNext
void setNext(HalfEdge *e)
Definition HalfEdge.h:218
geos::edgegraph::HalfEdge::prev
HalfEdge * prev() const
geos::edgegraph::HalfEdge::insert
void insert(HalfEdge *eAdd)
geos::edgegraph::HalfEdge::next
HalfEdge * next() const
Definition HalfEdge.h:188
geos::edgegraph::HalfEdge::link
void link(HalfEdge *p_sym)
geos::edgegraph::HalfEdge::directionY
double directionY() const
Definition HalfEdge.h:171
geos::edgegraph::HalfEdge::prevNode
HalfEdge * prevNode()
geos::edgegraph::HalfEdge::isEdgesSorted
bool isEdgesSorted() const
geos::edgegraph::HalfEdge::dest
const geom::CoordinateXYZM & dest() const
Definition HalfEdge.h:157
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38