KiCad PCB EDA Suite
|
#include <vertex_set.h>
Public Member Functions | |
VERTEX (int aIndex, double aX, double aY, VERTEX_SET *aParent, void *aUserData=nullptr) | |
VERTEX & | operator= (const VERTEX &)=delete |
VERTEX & | operator= (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. | |
VERTEX * | split (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 (bool aMatchUserData=false) 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_SET * | parent |
VERTEX * | prev = nullptr |
VERTEX * | next = nullptr |
uint32_t | z = 0 |
VERTEX * | prevZ = nullptr |
VERTEX * | nextZ = nullptr |
void * | m_userData = nullptr |
Definition at line 57 of file vertex_set.h.
|
inline |
Definition at line 61 of file vertex_set.h.
|
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.
Referenced by POLYGON_TRIANGULATION::earcutList(), POLYGON_TRIANGULATION::goodSplit(), and POLYGON_TRIANGULATION::TesselatePolygon().
|
inline |
Definition at line 79 of file vertex_set.h.
References m_userData.
Referenced by VERTEX_CONNECTOR::FindResults(), and isEar().
Check to see if triangle surrounds our current vertex.
Definition at line 191 of file vertex_set.h.
Referenced by isEar().
bool VERTEX::isEar | ( | bool | aMatchUserData = false | ) | 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.
aMatchUserData | if true, the user data of the vertices must match. This can be useful when the vertices come from different polygons. |
Definition at line 244 of file vertex_set.cpp.
References VERTEX_SET::area(), GetUserData(), inTriangle(), m_userData, next, nextZ, parent, prev, prevZ, x, y, z, and VERTEX_SET::zOrder().
Referenced by POLYGON_TRIANGULATION::earcutList(), and VERTEX_CONNECTOR::FindResults().
|
inline |
Definition at line 77 of file vertex_set.h.
|
inline |
Definition at line 73 of file vertex_set.h.
|
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 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.
Definition at line 212 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().
|
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().
void VERTEX::updateOrder | ( | ) |
Definition at line 237 of file vertex_set.cpp.
References parent, x, y, z, and VERTEX_SET::zOrder().
Referenced by updateList().
|
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().
const int VERTEX::i |
Definition at line 234 of file vertex_set.h.
Referenced by POLYGON_TRIANGULATION::earcutList(), POLYGON_TEST::FindPairs(), VERTEX_CONNECTOR::FindResults(), POLYGON_TEST::getKink(), POLYGON_TRIANGULATION::goodSplit(), POLYGON_TRIANGULATION::intersectsPolygon(), split(), and POLYGON_TRIANGULATION::splitPolygon().
void* VERTEX::m_userData = nullptr |
Definition at line 250 of file vertex_set.h.
Referenced by GetUserData(), isEar(), and split().
VERTEX* VERTEX::next = nullptr |
Definition at line 241 of file vertex_set.h.
Referenced by area(), VERTEX_SET::createList(), POLYGON_TRIANGULATION::earcutList(), POLYGON_TEST::FindPairs(), VERTEX_CONNECTOR::FindResults(), POLYGON_TEST::getKink(), VERTEX_SET::getNextOutlineVertex(), POLYGON_TRIANGULATION::goodSplit(), VERTEX_SET::insertVertex(), isEar(), POLYGON_TRIANGULATION::isTooSmall(), POLYGON_TRIANGULATION::logVertices(), VERTEX_SET::middleInside(), remove(), POLYGON_TRIANGULATION::removeNullTriangles(), POLYGON_TRIANGULATION::simplifyList(), split(), POLYGON_TRIANGULATION::splitPolygon(), POLYGON_TRIANGULATION::subdividePolygon(), POLYGON_TRIANGULATION::TesselatePolygon(), updateList(), and zSort().
VERTEX* VERTEX::nextZ = nullptr |
Definition at line 248 of file vertex_set.h.
Referenced by POLYGON_TEST::getKink(), VERTEX_SET::getNextOutlineVertex(), VERTEX_CONNECTOR::getPoint(), VERTEX_SET::getPrevOutlineVertex(), POLYGON_TRIANGULATION::goodSplit(), isEar(), remove(), POLYGON_TRIANGULATION::splitPolygon(), and zSort().
VERTEX_SET* VERTEX::parent |
Definition at line 237 of file vertex_set.h.
Referenced by isEar(), split(), and updateOrder().
VERTEX* VERTEX::prev = nullptr |
Definition at line 240 of file vertex_set.h.
Referenced by POLYGON_TRIANGULATION::earcutList(), POLYGON_TEST::FindPairs(), VERTEX_CONNECTOR::FindResults(), POLYGON_TEST::getKink(), VERTEX_SET::getNextOutlineVertex(), VERTEX_SET::getPrevOutlineVertex(), POLYGON_TRIANGULATION::goodSplit(), VERTEX_SET::insertVertex(), isEar(), POLYGON_TRIANGULATION::isTooSmall(), remove(), POLYGON_TRIANGULATION::removeNullTriangles(), POLYGON_TRIANGULATION::simplifyList(), split(), POLYGON_TRIANGULATION::splitPolygon(), POLYGON_TRIANGULATION::TesselatePolygon(), and updateList().
VERTEX* VERTEX::prevZ = nullptr |
Definition at line 247 of file vertex_set.h.
Referenced by POLYGON_TEST::getKink(), VERTEX_SET::getNextOutlineVertex(), VERTEX_CONNECTOR::getPoint(), VERTEX_SET::getPrevOutlineVertex(), POLYGON_TRIANGULATION::goodSplit(), isEar(), remove(), POLYGON_TRIANGULATION::splitPolygon(), and zSort().
const double VERTEX::x |
Definition at line 235 of file vertex_set.h.
Referenced by area(), VERTEX_SET::area(), POLYGON_TEST::getKink(), VERTEX_CONNECTOR::getPoint(), inTriangle(), isEar(), POLYGON_TEST::isSubstantial(), POLYGON_TRIANGULATION::isTooSmall(), POLYGON_TRIANGULATION::logVertices(), VERTEX_SET::middleInside(), operator==(), POLYGON_TRIANGULATION::overlapping(), POLYGON_TRIANGULATION::removeNullTriangles(), VERTEX_SET::same_point(), POLYGON_TRIANGULATION::simplifyList(), split(), POLYGON_TRIANGULATION::subdividePolygon(), and updateOrder().
const double VERTEX::y |
Definition at line 236 of file vertex_set.h.
Referenced by area(), VERTEX_SET::area(), POLYGON_TEST::getKink(), VERTEX_SET::getNextOutlineVertex(), VERTEX_CONNECTOR::getPoint(), VERTEX_SET::getPrevOutlineVertex(), inTriangle(), isEar(), POLYGON_TEST::isSubstantial(), POLYGON_TRIANGULATION::isTooSmall(), POLYGON_TRIANGULATION::logVertices(), VERTEX_SET::middleInside(), operator==(), POLYGON_TRIANGULATION::overlapping(), POLYGON_TRIANGULATION::removeNullTriangles(), VERTEX_SET::same_point(), POLYGON_TRIANGULATION::simplifyList(), split(), POLYGON_TRIANGULATION::subdividePolygon(), and updateOrder().
uint32_t VERTEX::z = 0 |
Definition at line 244 of file vertex_set.h.
Referenced by POLYGON_TEST::getKink(), VERTEX_CONNECTOR::getPoint(), isEar(), and updateOrder().