KiCad PCB EDA Suite
SHAPE_POLY_SET::TRIANGULATED_POLYGON Class Reference

#include <shape_poly_set.h>

Classes

struct  TRI
 

Public Member Functions

 TRIANGULATED_POLYGON ()
 
 TRIANGULATED_POLYGON (const TRIANGULATED_POLYGON &aOther)
 
 ~TRIANGULATED_POLYGON ()
 
void Clear ()
 
void GetTriangle (int index, VECTOR2I &a, VECTOR2I &b, VECTOR2I &c) const
 
TRIANGULATED_POLYGONoperator= (const TRIANGULATED_POLYGON &aOther)
 
void AddTriangle (int a, int b, int c)
 
void AddVertex (const VECTOR2I &aP)
 
size_t GetTriangleCount () const
 
std::deque< TRI > & Triangles ()
 
size_t GetVertexCount () const
 
void Move (const VECTOR2I &aVec)
 

Private Attributes

std::deque< TRIm_triangles
 
std::deque< VECTOR2Im_vertices
 

Detailed Description

Definition at line 72 of file shape_poly_set.h.

Constructor & Destructor Documentation

◆ TRIANGULATED_POLYGON() [1/2]

SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRIANGULATED_POLYGON ( )

Definition at line 2324 of file shape_poly_set.cpp.

2325 {
2326 }

◆ TRIANGULATED_POLYGON() [2/2]

SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRIANGULATED_POLYGON ( const TRIANGULATED_POLYGON aOther)

Definition at line 2302 of file shape_poly_set.cpp.

2303 {
2304  m_vertices = aOther.m_vertices;
2305  m_triangles = aOther.m_triangles;
2306 
2307  for( TRI& tri : m_triangles )
2308  tri.parent = this;
2309 }

References m_triangles, and m_vertices.

◆ ~TRIANGULATED_POLYGON()

SHAPE_POLY_SET::TRIANGULATED_POLYGON::~TRIANGULATED_POLYGON ( )

Definition at line 2329 of file shape_poly_set.cpp.

2330 {
2331 }

Member Function Documentation

◆ AddTriangle()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::AddTriangle ( int  a,
int  b,
int  c 
)

Definition at line 2296 of file shape_poly_set.cpp.

2297 {
2298  m_triangles.emplace_back( a, b, c, this );
2299 }

References m_triangles.

Referenced by PolygonTriangulation::earcutList().

◆ AddVertex()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::AddVertex ( const VECTOR2I aP)
inline

Definition at line 150 of file shape_poly_set.h.

151  {
152  m_vertices.push_back( aP );
153  }

References m_vertices.

Referenced by PolygonTriangulation::insertVertex().

◆ Clear()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::Clear ( )
inline

Definition at line 132 of file shape_poly_set.h.

133  {
134  m_vertices.clear();
135  m_triangles.clear();
136  }

References m_triangles, and m_vertices.

Referenced by PolygonTriangulation::TesselatePolygon().

◆ GetTriangle()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::GetTriangle ( int  index,
VECTOR2I a,
VECTOR2I b,
VECTOR2I c 
) const
inline

Definition at line 138 of file shape_poly_set.h.

139  {
140  auto tri = m_triangles[ index ];
141  a = m_vertices[ tri.a ];
142  b = m_vertices[ tri.b ];
143  c = m_vertices[ tri.c ];
144  }

References m_triangles, and m_vertices.

Referenced by ConvertPolygonToTriangles(), and PNS_KICAD_IFACE_BASE::syncZone().

◆ GetTriangleCount()

size_t SHAPE_POLY_SET::TRIANGULATED_POLYGON::GetTriangleCount ( ) const
inline

Definition at line 155 of file shape_poly_set.h.

156  {
157  return m_triangles.size();
158  }

References m_triangles.

Referenced by PNS_KICAD_IFACE_BASE::syncZone().

◆ GetVertexCount()

size_t SHAPE_POLY_SET::TRIANGULATED_POLYGON::GetVertexCount ( ) const
inline

Definition at line 165 of file shape_poly_set.h.

166  {
167  return m_vertices.size();
168  }

References m_vertices.

Referenced by PolygonTriangulation::insertVertex().

◆ Move()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::Move ( const VECTOR2I aVec)
inline

Definition at line 170 of file shape_poly_set.h.

171  {
172  for( auto& vertex : m_vertices )
173  vertex += aVec;
174  }

References m_vertices.

◆ operator=()

SHAPE_POLY_SET::TRIANGULATED_POLYGON & SHAPE_POLY_SET::TRIANGULATED_POLYGON::operator= ( const TRIANGULATED_POLYGON aOther)

Definition at line 2312 of file shape_poly_set.cpp.

2313 {
2314  m_vertices = aOther.m_vertices;
2315  m_triangles = aOther.m_triangles;
2316 
2317  for( TRI& tri : m_triangles )
2318  tri.parent = this;
2319 
2320  return *this;
2321 }

References m_triangles, and m_vertices.

◆ Triangles()

std::deque<TRI>& SHAPE_POLY_SET::TRIANGULATED_POLYGON::Triangles ( )
inline

Definition at line 160 of file shape_poly_set.h.

161  {
162  return m_triangles;
163  }

References m_triangles.

Member Data Documentation

◆ m_triangles

std::deque<TRI> SHAPE_POLY_SET::TRIANGULATED_POLYGON::m_triangles
private

◆ m_vertices


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