GEOS  3.14.0dev
Public Member Functions | Static Public Member Functions | Protected Attributes | Friends | List of all members
geos::triangulate::tri::Tri Class Reference

#include <Tri.h>

Inherited by geos::algorithm::hull::HullTri.

Public Member Functions

 Tri (const Coordinate &c0, const Coordinate &c1, const Coordinate &c2)
 
void setAdjacent (Tri *p_tri0, Tri *p_tri1, Tri *p_tri2)
 
void setAdjacent (const Coordinate &pt, Tri *tri)
 
void setTri (TriIndex edgeIndex, Tri *tri)
 
void flip (TriIndex index)
 
void remove ()
 
void remove (TriList< Tri > &triList)
 
void validate ()
 
void validateAdjacent (TriIndex index)
 
std::pair< const Coordinate &, const Coordinate & > getEdge (Tri *neighbor) const
 
const CoordinategetEdgeStart (TriIndex i) const
 
const CoordinategetEdgeEnd (TriIndex i) const
 
bool hasCoordinate (const Coordinate &v) const
 
const CoordinategetCoordinate (TriIndex i) const
 
TriIndex getIndex (const Coordinate &p) const
 
TriIndex getIndex (const Tri *tri) const
 
TrigetAdjacent (TriIndex i) const
 
bool hasAdjacent (TriIndex i) const
 
bool hasAdjacent () const
 
bool isAdjacent (Tri *tri) const
 
int numAdjacent () const
 
bool isInteriorVertex (TriIndex index) const
 
bool isBorder () const
 
bool isBoundary (TriIndex index) const
 
Coordinate midpoint (TriIndex edgeIndex) const
 
double getArea () const
 
double getLength () const
 
double getLength (TriIndex i) const
 
std::unique_ptr< PolygontoPolygon (const GeometryFactory *gf) const
 

Static Public Member Functions

static TriIndex next (TriIndex i)
 
static TriIndex prev (TriIndex i)
 
static TriIndex oppVertex (TriIndex edgeIndex)
 
static TriIndex oppEdge (TriIndex vertexIndex)
 
static std::unique_ptr< GeometrytoGeometry (std::set< Tri * > &tris, const GeometryFactory *gf)
 

Protected Attributes

Coordinate p0
 
Coordinate p1
 
Coordinate p2
 
Tritri0
 
Tritri1
 
Tritri2
 

Friends

std::ostream & operator<< (std::ostream &os, const Tri &)
 

Detailed Description

A memory-efficient representation of a triangle in a triangulation. Contains three vertices, and links to adjacent Tris for each edge. Tris are constructed independently, and if needed linked into a triangulation using TriangulationBuilder.

Author
Martin Davis

Member Function Documentation

◆ flip()

void geos::triangulate::tri::Tri::flip ( TriIndex  index)

Interchanges the vertices of this triangle and a neighbor so that their common edge becomes the the other diagonal of the quadrilateral they form. Neighbour triangle links are modified accordingly.

Parameters
indexthe index of the adjacent tri to flip with

◆ isInteriorVertex()

bool geos::triangulate::tri::Tri::isInteriorVertex ( TriIndex  index) const

Tests if a tri vertex is interior. A vertex of a triangle is interior if it is fully surrounded by other triangles.

Parameters
indexthe vertex index
Returns
true if the vertex is interior

◆ remove()

void geos::triangulate::tri::Tri::remove ( )

Removes this triangle from a triangulation. All adjacent references and the references to this Tri in the adjacent Tris are set to nullptr.

Member Data Documentation

◆ tri0

Tri* geos::triangulate::tri::Tri::tri0
protected

triN is the adjacent triangle across the edge pN - pNN. pNN is the next vertex CW from pN.


The documentation for this class was generated from the following file: