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

Classes

struct  Vertex
 

Public Member Functions

 POLYGON_TEST (int aLimit)
 
bool FindPairs (const SHAPE_LINE_CHAIN &aPoly)
 
std::set< std::pair< int, int > > & GetVertices ()
 

Private Member Functions

int32_t zOrder (const double aX, const double aY) const
 Calculate the Morton code of the Vertex http://www.graphics.stanford.edu/~seander/bithacks.html#InterleaveBMN.
 
constexpr bool same_point (const Vertex *aA, const Vertex *aB) const
 
VertexgetNextOutlineVertex (const Vertex *aPt) const
 
VertexgetPrevOutlineVertex (const Vertex *aPt) const
 
bool isSubstantial (const Vertex *aA, const Vertex *aB) const
 Checks to see if there is a "substantial" protrusion in each polygon produced by the cut from aA to aB.
 
VertexcreateList (const SHAPE_LINE_CHAIN &points)
 Take a SHAPE_LINE_CHAIN and links each point into a circular, doubly-linked list.
 
VertexgetKink (Vertex *aPt) const
 
double area (const Vertex *p, const Vertex *q, const Vertex *r) const
 Return the twice the signed area of the triangle formed by vertices p, q, and r.
 
bool locallyInside (const Vertex *a, const Vertex *b) const
 Check whether the segment from vertex a -> vertex b is inside the polygon around the immediate area of vertex a.
 
VertexinsertVertex (int aIndex, const VECTOR2I &pt, Vertex *last)
 Create an entry in the vertices lookup and optionally inserts the newly created vertex into an existing linked list.
 

Private Attributes

int m_limit
 
BOX2I m_bbox
 
std::deque< Vertexm_vertices
 
std::set< std::pair< int, int > > m_hits
 

Detailed Description

Definition at line 114 of file drc_test_provider_connection_width.cpp.

Constructor & Destructor Documentation

◆ POLYGON_TEST()

POLYGON_TEST::POLYGON_TEST ( int  aLimit)
inline

Definition at line 117 of file drc_test_provider_connection_width.cpp.

Member Function Documentation

◆ area()

double POLYGON_TEST::area ( const Vertex p,
const Vertex q,
const Vertex r 
) const
inlineprivate

Return the twice the signed area of the triangle formed by vertices p, q, and r.

Definition at line 558 of file drc_test_provider_connection_width.cpp.

References POLYGON_TEST::Vertex::x, and POLYGON_TEST::Vertex::y.

Referenced by locallyInside().

◆ createList()

Vertex * POLYGON_TEST::createList ( const SHAPE_LINE_CHAIN points)
inlineprivate

◆ FindPairs()

◆ getKink()

◆ getNextOutlineVertex()

Vertex * POLYGON_TEST::getNextOutlineVertex ( const Vertex aPt) const
inlineprivate

◆ getPrevOutlineVertex()

Vertex * POLYGON_TEST::getPrevOutlineVertex ( const Vertex aPt) const
inlineprivate

◆ GetVertices()

std::set< std::pair< int, int > > & POLYGON_TEST::GetVertices ( )
inline

Definition at line 159 of file drc_test_provider_connection_width.cpp.

References m_hits.

◆ insertVertex()

Vertex * POLYGON_TEST::insertVertex ( int  aIndex,
const VECTOR2I pt,
Vertex last 
)
inlineprivate

Create an entry in the vertices lookup and optionally inserts the newly created vertex into an existing linked list.

Returns
a pointer to the newly created vertex.

Definition at line 590 of file drc_test_provider_connection_width.cpp.

References m_vertices, POLYGON_TEST::Vertex::next, POLYGON_TEST::Vertex::prev, VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by createList().

◆ isSubstantial()

bool POLYGON_TEST::isSubstantial ( const Vertex aA,
const Vertex aB 
) const
inlineprivate

Checks to see if there is a "substantial" protrusion in each polygon produced by the cut from aA to aB.

Substantial in this case means that the polygon bulges out to a wider cross-section than the distance from aA to aB

Parameters
aAStarting point in the polygon
aBEnding point in the polygon
Returns
True if the two polygons are both "substantial"

Definition at line 389 of file drc_test_provider_connection_width.cpp.

References std::abs(), getNextOutlineVertex(), getPrevOutlineVertex(), m_limit, m_vertices, same_point(), POLYGON_TEST::Vertex::x, and POLYGON_TEST::Vertex::y.

Referenced by getKink().

◆ locallyInside()

bool POLYGON_TEST::locallyInside ( const Vertex a,
const Vertex b 
) const
inlineprivate

Check whether the segment from vertex a -> vertex b is inside the polygon around the immediate area of vertex a.

We don't define the exact area over which the segment is inside but it is guaranteed to be inside the polygon immediately adjacent to vertex a.

Returns
true if the segment from a->b is inside a's polygon next to vertex a.

Definition at line 573 of file drc_test_provider_connection_width.cpp.

References area(), getNextOutlineVertex(), and getPrevOutlineVertex().

Referenced by getKink().

◆ same_point()

constexpr bool POLYGON_TEST::same_point ( const Vertex aA,
const Vertex aB 
) const
inlineconstexprprivate

◆ zOrder()

int32_t POLYGON_TEST::zOrder ( const double  aX,
const double  aY 
) const
inlineprivate

Member Data Documentation

◆ m_bbox

BOX2I POLYGON_TEST::m_bbox
private

Definition at line 613 of file drc_test_provider_connection_width.cpp.

Referenced by FindPairs(), and zOrder().

◆ m_hits

std::set<std::pair<int, int> > POLYGON_TEST::m_hits
private

Definition at line 615 of file drc_test_provider_connection_width.cpp.

Referenced by FindPairs(), and GetVertices().

◆ m_limit

int POLYGON_TEST::m_limit
private

Definition at line 612 of file drc_test_provider_connection_width.cpp.

Referenced by getKink(), and isSubstantial().

◆ m_vertices

std::deque<Vertex> POLYGON_TEST::m_vertices
private

Definition at line 614 of file drc_test_provider_connection_width.cpp.

Referenced by FindPairs(), insertVertex(), and isSubstantial().


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