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.
References i, m_userData, parent, x, and y.
Referenced by area(), inTriangle(), isEar(), operator!=(), operator=(), operator=(), operator==(), split(), updateList(), and zSort().
|
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, VERTEX(), x, and y.
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().
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 264 of file vertex_set.cpp.
References GetUserData(), inTriangle(), m_userData, next, nextZ, parent, prev, prevZ, VERTEX(), x, y, and z.
Referenced by POLYGON_TRIANGULATION::earcutList(), and VERTEX_CONNECTOR::FindResults().
|
inline |
Definition at line 77 of file vertex_set.h.
References VERTEX().
|
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 232 of file vertex_set.cpp.
References i, m_userData, next, parent, prev, VERTEX(), 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(), VERTEX(), and zSort().
Referenced by POLYGON_TRIANGULATION::splitPolygon(), POLYGON_TRIANGULATION::subdividePolygon(), POLYGON_TRIANGULATION::TesselatePolygon(), and VERTEX_CONNECTOR::VERTEX_CONNECTOR().
void VERTEX::updateOrder | ( | ) |
Definition at line 257 of file vertex_set.cpp.
References parent, x, y, and z.
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, prevZ, and VERTEX().
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(), POLYGON_TRIANGULATION::splitPolygon(), and VERTEX().
void* VERTEX::m_userData = nullptr |
Definition at line 250 of file vertex_set.h.
Referenced by GetUserData(), isEar(), split(), and VERTEX().
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(), updateOrder(), and VERTEX().
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(), updateOrder(), and VERTEX().
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(), updateOrder(), and VERTEX().
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().