KiCad PCB EDA Suite
Loading...
Searching...
No Matches
VERTEX Class Reference

#include <vertex_set.h>

Public Member Functions

 VERTEX (int aIndex, double aX, double aY, VERTEX_SET *aParent, void *aUserData=nullptr)
 
VERTEXoperator= (const VERTEX &)=delete
 
VERTEXoperator= (VERTEX &&)=delete
 
bool operator== (const VERTEX &rhs) const
 
bool operator!= (const VERTEX &rhs) const
 
void * GetUserData () const
 
void remove ()
 Remove the node from the linked list and z-ordered linked list.
 
VERTEXsplit (VERTEX *b)
 Split the referenced polygon between the reference point and vertex b, assuming they are in the same polygon.
 
void updateOrder ()
 
void updateList ()
 After inserting or changing nodes, this function should be called to remove duplicate vertices and ensure z-ordering is correct.
 
void zSort ()
 Sort all vertices in this vertex's list by their Morton code.
 
bool inTriangle (const VERTEX &a, const VERTEX &b, const VERTEX &c)
 Check to see if triangle surrounds our current vertex.
 
double area (const VERTEX *aEnd=nullptr) const
 Returns the signed area of the polygon connected to the current vertex, optionally ending at a specified vertex.
 
bool isEar () const
 Check whether the given vertex is in the middle of an ear.
 

Public Attributes

const int i
 
const double x
 
const double y
 
VERTEX_SETparent
 
VERTEXprev = nullptr
 
VERTEXnext = nullptr
 
int32_t z = 0
 
VERTEXprevZ = nullptr
 
VERTEXnextZ = nullptr
 
void * m_userData = nullptr
 

Detailed Description

Definition at line 57 of file vertex_set.h.

Constructor & Destructor Documentation

◆ VERTEX()

VERTEX::VERTEX ( int  aIndex,
double  aX,
double  aY,
VERTEX_SET aParent,
void *  aUserData = nullptr 
)
inline

Definition at line 61 of file vertex_set.h.

Member Function Documentation

◆ area()

double VERTEX::area ( const VERTEX aEnd = nullptr) const
inline

Returns the signed area of the polygon connected to the current vertex, optionally ending at a specified vertex.

Definition at line 202 of file vertex_set.h.

References next, x, and y.

Referenced by POLYGON_TRIANGULATION::earcutList(), POLYGON_TRIANGULATION::goodSplit(), and POLYGON_TRIANGULATION::TesselatePolygon().

◆ GetUserData()

void * VERTEX::GetUserData ( ) const
inline

Definition at line 79 of file vertex_set.h.

References m_userData.

Referenced by VERTEX_CONNECTOR::FindResults().

◆ inTriangle()

bool VERTEX::inTriangle ( const VERTEX a,
const VERTEX b,
const VERTEX c 
)
inline

Check to see if triangle surrounds our current vertex.

Definition at line 191 of file vertex_set.h.

References x, and y.

Referenced by isEar().

◆ isEar()

bool VERTEX::isEar ( ) const

Check whether the given vertex is in the middle of an ear.

This works by walking forward and backward in zOrder to the limits of the minimal bounding box formed around the triangle, checking whether any points are located inside the given triangle.

Returns
true if aEar is the apex point of a ear in the polygon.

Definition at line 241 of file vertex_set.cpp.

References VERTEX_SET::area(), inTriangle(), next, nextZ, parent, prev, prevZ, x, y, z, and VERTEX_SET::zOrder().

Referenced by POLYGON_TRIANGULATION::earcutList(), and VERTEX_CONNECTOR::FindResults().

◆ operator!=()

bool VERTEX::operator!= ( const VERTEX rhs) const
inline

Definition at line 77 of file vertex_set.h.

◆ operator=() [1/2]

VERTEX & VERTEX::operator= ( const VERTEX )
delete

◆ operator=() [2/2]

VERTEX & VERTEX::operator= ( VERTEX &&  )
delete

◆ operator==()

bool VERTEX::operator== ( const VERTEX rhs) const
inline

Definition at line 73 of file vertex_set.h.

References x, and y.

◆ remove()

void VERTEX::remove ( )
inline

Remove the node from the linked list and z-ordered linked list.

Definition at line 84 of file vertex_set.h.

References next, nextZ, prev, and prevZ.

Referenced by VERTEX_SET::createList(), POLYGON_TRIANGULATION::earcutList(), POLYGON_TRIANGULATION::removeNullTriangles(), POLYGON_TRIANGULATION::simplifyList(), and updateList().

◆ split()

VERTEX * VERTEX::split ( VERTEX b)

Split the referenced polygon between the reference point and vertex b, assuming they are in the same polygon.

Notes that while we create a new vertex pointer for the linked list, we maintain the same vertex index value from the original polygon. In this way, we have two polygons that both share the same vertices.

Returns
the newly created vertex in the polygon that does not include the reference vertex.

Definition at line 209 of file vertex_set.cpp.

References i, VERTEX_SET::insertVertex(), m_userData, VERTEX_SET::m_vertices, next, parent, prev, x, and y.

Referenced by POLYGON_TRIANGULATION::splitPolygon().

◆ updateList()

void VERTEX::updateList ( )
inline

After inserting or changing nodes, this function should be called to remove duplicate vertices and ensure z-ordering is correct.

Remove duplicates

Definition at line 121 of file vertex_set.h.

References next, prev, remove(), updateOrder(), and zSort().

Referenced by POLYGON_TRIANGULATION::splitPolygon(), POLYGON_TRIANGULATION::subdividePolygon(), POLYGON_TRIANGULATION::TesselatePolygon(), and VERTEX_CONNECTOR::VERTEX_CONNECTOR().

◆ updateOrder()

void VERTEX::updateOrder ( )

Definition at line 234 of file vertex_set.cpp.

References parent, x, y, z, and VERTEX_SET::zOrder().

Referenced by updateList().

◆ zSort()

void VERTEX::zSort ( )
inline

Sort all vertices in this vertex's list by their Morton code.

Definition at line 150 of file vertex_set.h.

References next, nextZ, and prevZ.

Referenced by updateList().

Member Data Documentation

◆ i

◆ m_userData

void* VERTEX::m_userData = nullptr

Definition at line 246 of file vertex_set.h.

Referenced by GetUserData(), and split().

◆ next

◆ nextZ

◆ parent

VERTEX_SET* VERTEX::parent

Definition at line 233 of file vertex_set.h.

Referenced by isEar(), split(), and updateOrder().

◆ prev

◆ prevZ

◆ x

◆ y

◆ z

int32_t VERTEX::z = 0

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