KiCad PCB EDA Suite
Loading...
Searching...
No Matches
polygon_2d.cpp File Reference
#include "polygon_2d.h"
#include "../ray.h"
#include <wx/debug.h>

Go to the source code of this file.

Macros

#define MAX_NR_DIVISIONS   96
 

Typedefs

typedef std::vector< SFVEC2FKF_POINTS
 

Functions

static bool polygon_IsPointInside (const SEGMENTS &aSegments, const SFVEC2F &aPoint)
 
static bool intersect (const SEGMENT_WITH_NORMALS &aSeg, const SFVEC2F &aStart, const SFVEC2F &aEnd)
 
static void extractPathsFrom (const SEGMENTS_WIDTH_NORMALS &aSegList, const BBOX_2D &aBBox, SEGMENTS_WIDTH_NORMALS &aOutSegThatIntersect)
 
static void polygon_Convert (const SHAPE_LINE_CHAIN &aPath, SEGMENTS &aOutSegment, float aBiuTo3dUnitsScale)
 
void ConvertPolygonToBlocks (const SHAPE_POLY_SET &aMainPath, CONTAINER_2D_BASE &aDstContainer, float aBiuTo3dUnitsScale, float aDivFactor, const BOARD_ITEM &aBoardItem, int aPolyIndex)
 Use a polygon in the format of the ClipperLib::Path and process it and create multiple 2d objects (POLYGON_2D and DUMMY_BLOCK_2D) that can be used to represent this polygon area.
 

Macro Definition Documentation

◆ MAX_NR_DIVISIONS

#define MAX_NR_DIVISIONS   96

Definition at line 270 of file polygon_2d.cpp.

Typedef Documentation

◆ KF_POINTS

typedef std::vector<SFVEC2F> KF_POINTS

Definition at line 268 of file polygon_2d.cpp.

Function Documentation

◆ ConvertPolygonToBlocks()

void ConvertPolygonToBlocks ( const SHAPE_POLY_SET aMainPath,
CONTAINER_2D_BASE aDstContainer,
float  aBiuTo3dUnitsScale,
float  aDivFactor,
const BOARD_ITEM aBoardItem,
int  aPolyIndex 
)

Use a polygon in the format of the ClipperLib::Path and process it and create multiple 2d objects (POLYGON_2D and DUMMY_BLOCK_2D) that can be used to represent this polygon area.

Parameters
aMainPaththe polygon are that was converted from the pcb board
aDstContainerthe destination container to put the created sub blocks
aBiuTo3dUnitsScalethe rendering target 3d scale
aDivFactora division factor (in 3Dunits) to divide the polygon plane, 0.0f will use the internal polygon segm statistics

Definition at line 378 of file polygon_2d.cpp.

References CONTAINER_2D_BASE::Add(), SHAPE_POLY_SET::AddOutline(), SHAPE_POLY_SET::BooleanIntersection(), SHAPE_POLY_SET::COutline(), extractPathsFrom(), BOX2< Vec >::GetBottom(), BBOX_2D::GetExtent(), BOX2< Vec >::GetLeft(), BOX2< Vec >::GetRight(), BOX2< Vec >::GetTop(), SHAPE_POLY_SET::Hole(), SHAPE_POLY_SET::HoleCount(), OUTERS_AND_HOLES::m_Holes, OUTERS_AND_HOLES::m_Outers, POLYSEGMENT::m_Start, SEGMENT_WITH_NORMALS::m_Start, BBOX_2D::Max(), MAX_NR_DIVISIONS, BBOX_2D::Min(), SHAPE_POLY_SET::Outline(), SHAPE_POLY_SET::OutlineCount(), path, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE, polygon_Convert(), polygon_IsPointInside(), BBOX_2D::Reset(), BBOX_2D::ScaleNextUp(), SHAPE_LINE_CHAIN::SetClosed(), BBOX_2D::Union(), VECTOR2< T >::x, and VECTOR2< T >::y.

Referenced by RENDER_3D_RAYTRACE_BASE::Reload().

◆ extractPathsFrom()

static void extractPathsFrom ( const SEGMENTS_WIDTH_NORMALS aSegList,
const BBOX_2D aBBox,
SEGMENTS_WIDTH_NORMALS aOutSegThatIntersect 
)
static

◆ intersect()

static bool intersect ( const SEGMENT_WITH_NORMALS aSeg,
const SFVEC2F aStart,
const SFVEC2F aEnd 
)
static

◆ polygon_Convert()

static void polygon_Convert ( const SHAPE_LINE_CHAIN aPath,
SEGMENTS aOutSegment,
float  aBiuTo3dUnitsScale 
)
static

◆ polygon_IsPointInside()

static bool polygon_IsPointInside ( const SEGMENTS aSegments,
const SFVEC2F aPoint 
)
static

Definition at line 34 of file polygon_2d.cpp.

Referenced by ConvertPolygonToBlocks(), and POLYGON_2D::IsPointInside().