KiCad PCB EDA Suite
ctriangle2d.h File Reference
#include "cobject2d.h"
#include "../accelerators/ccontainer2d.h"
#include <geometry/shape_line_chain.h>
#include <geometry/shape_poly_set.h>
#include <clipper.hpp>

Go to the source code of this file.

Classes

class  CTRIANGLE2D
 

Functions

void Convert_shape_line_polygon_to_triangles (SHAPE_POLY_SET &aPolyList, CGENERICCONTAINER2D &aDstContainer, float aBiuTo3DunitsScale, const BOARD_ITEM &aBoardItem)
 

Function Documentation

void Convert_shape_line_polygon_to_triangles ( SHAPE_POLY_SET aPolyList,
CGENERICCONTAINER2D aDstContainer,
float  aBiuTo3DunitsScale,
const BOARD_ITEM aBoardItem 
)

Definition at line 132 of file ctriangle2d.cpp.

References CGENERICCONTAINER2D::Add(), SHAPE_POLY_SET::CacheTriangulation(), CTRIANGLE2D::CTRIANGLE2D(), i, SHAPE_POLY_SET::TriangulatedPolyCount(), SHAPE_POLY_SET::TriangulatedPolygon(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by CINFO3D_VISU::AddShapeWithClearanceToContainer(), CINFO3D_VISU::AddSolidAreasShapesToContainer(), CINFO3D_VISU::createNewPadWithClearance(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), CTRIANGLE2D::GetP3(), and C3D_RENDER_OGL_LEGACY::reload().

136 {
137 
138  aPolyList.CacheTriangulation();
139  const double conver_d = (double)aBiuTo3DunitsScale;
140 
141  for( unsigned int j = 0; j < aPolyList.TriangulatedPolyCount(); j++ )
142  {
143  auto triPoly = aPolyList.TriangulatedPolygon( j );
144 
145  for( size_t i = 0; i < triPoly->GetTriangleCount(); i++ )
146  {
147  VECTOR2I a;
148  VECTOR2I b;
149  VECTOR2I c;
150  triPoly->GetTriangle( i, a, b, c );
151 
152  aDstContainer.Add( new CTRIANGLE2D( SFVEC2F( a.x * conver_d,
153  -a.y * conver_d ),
154  SFVEC2F( b.x * conver_d,
155  -b.y * conver_d ),
156  SFVEC2F( c.x * conver_d,
157  -c.y * conver_d ),
158  aBoardItem ) );
159  }
160 
161  }
162 }
glm::vec2 SFVEC2F
Definition: xv3d_types.h:45
const TRIANGULATED_POLYGON * TriangulatedPolygon(int aIndex) const
void Add(COBJECT2D *aObject)
Definition: ccontainer2d.h:52
unsigned int TriangulatedPolyCount() const
Returns the number of triangulated polygons
size_t i
Definition: json11.cpp:597