KiCad PCB EDA Suite
SHAPE_POLY_SET::TRIANGULATED_POLYGON Class Reference

#include <shape_poly_set.h>

Classes

struct  TRI
 

Public Member Functions

 TRIANGULATED_POLYGON (int aSourceOutline)
 
 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
 
int GetSourceOutlineIndex () const
 
void SetSourceOutlineIndex (int aIndex)
 
std::deque< TRI > & Triangles ()
 
const std::deque< TRI > & Triangles () const
 
size_t GetVertexCount () const
 
void Move (const VECTOR2I &aVec)
 

Private Attributes

int m_sourceOutline
 
std::deque< TRIm_triangles
 
std::deque< VECTOR2Im_vertices
 

Detailed Description

Definition at line 73 of file shape_poly_set.h.

Constructor & Destructor Documentation

◆ TRIANGULATED_POLYGON() [1/2]

SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRIANGULATED_POLYGON ( int  aSourceOutline)

Definition at line 2907 of file shape_poly_set.cpp.

2907 :
2908 m_sourceOutline( aSourceOutline )
2909{
2910}

◆ TRIANGULATED_POLYGON() [2/2]

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

Definition at line 2883 of file shape_poly_set.cpp.

2884{
2885 m_sourceOutline = aOther.m_sourceOutline;
2886 m_vertices = aOther.m_vertices;
2887 m_triangles = aOther.m_triangles;
2888
2889 for( TRI& tri : m_triangles )
2890 tri.parent = this;
2891}

References m_sourceOutline, m_triangles, and m_vertices.

◆ ~TRIANGULATED_POLYGON()

SHAPE_POLY_SET::TRIANGULATED_POLYGON::~TRIANGULATED_POLYGON ( )

Definition at line 2913 of file shape_poly_set.cpp.

2914{
2915}

Member Function Documentation

◆ AddTriangle()

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

Definition at line 2877 of file shape_poly_set.cpp.

2878{
2879 m_triangles.emplace_back( a, b, c, this );
2880}

References m_triangles.

Referenced by PolygonTriangulation::earcutList().

◆ AddVertex()

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

Definition at line 151 of file shape_poly_set.h.

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

References m_vertices.

Referenced by PolygonTriangulation::insertVertex().

◆ Clear()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::Clear ( )
inline

Definition at line 133 of file shape_poly_set.h.

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

References m_triangles, and m_vertices.

Referenced by PolygonTriangulation::TesselatePolygon().

◆ GetSourceOutlineIndex()

int SHAPE_POLY_SET::TRIANGULATED_POLYGON::GetSourceOutlineIndex ( ) const
inline

Definition at line 158 of file shape_poly_set.h.

158{ return m_sourceOutline; }

References m_sourceOutline.

◆ GetTriangle()

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

Definition at line 139 of file shape_poly_set.h.

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

References m_triangles, and m_vertices.

Referenced by ConvertPolygonToTriangles(), KIGFX::OPENGL_GAL::DrawGlyphs(), PNS_KICAD_IFACE_BASE::syncZone(), and KIFONT::OUTLINE_GLYPH::Triangulate().

◆ GetTriangleCount()

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

◆ GetVertexCount()

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

Definition at line 164 of file shape_poly_set.h.

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

References m_vertices.

Referenced by PolygonTriangulation::insertVertex().

◆ Move()

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

Definition at line 169 of file shape_poly_set.h.

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

References m_vertices.

◆ operator=()

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

Definition at line 2894 of file shape_poly_set.cpp.

2895{
2896 m_sourceOutline = aOther.m_sourceOutline;
2897 m_vertices = aOther.m_vertices;
2898 m_triangles = aOther.m_triangles;
2899
2900 for( TRI& tri : m_triangles )
2901 tri.parent = this;
2902
2903 return *this;
2904}

References m_sourceOutline, m_triangles, and m_vertices.

◆ SetSourceOutlineIndex()

void SHAPE_POLY_SET::TRIANGULATED_POLYGON::SetSourceOutlineIndex ( int  aIndex)
inline

Definition at line 159 of file shape_poly_set.h.

159{ m_sourceOutline = aIndex; }

References m_sourceOutline.

◆ Triangles() [1/2]

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

Definition at line 161 of file shape_poly_set.h.

161{ return m_triangles; }

References m_triangles.

◆ Triangles() [2/2]

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

Definition at line 162 of file shape_poly_set.h.

162{ return m_triangles; }

References m_triangles.

Member Data Documentation

◆ m_sourceOutline

int SHAPE_POLY_SET::TRIANGULATED_POLYGON::m_sourceOutline
private

◆ 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: