41 bool hasLocalBounds =
false;
55 hasLocalBounds =
true;
59 localBox.
Merge( padBox );
75 BOX2I itemBox = item->GetBoundingBox();
84 for(
int ci = 0; ci < 4; ++ci )
101 localBox = localItemBox;
102 hasLocalBounds =
true;
106 localBox.
Merge( localItemBox );
112 if( !hasLocalBounds )
133 std::vector<PCB_SHAPE*> closedShapes;
134 std::vector<PCB_SHAPE*> openShapes;
138 if( item->GetLayer() == aLayer && item->Type() ==
PCB_SHAPE_T )
145 closedShapes.push_back( shape );
149 openShapes.push_back( shape );
154 if( closedShapes.empty() && openShapes.empty() )
159 if( !openShapes.empty() )
161 int chainingEpsilon =
pcbIUScale.mmToIU( 0.02 );
175 shape->TransformShapeToPolygon( strokes, aLayer, 0, maxError,
ERROR_INSIDE );
187 for(
const PCB_SHAPE* shape : closedShapes )
189 switch( shape->GetShape() )
198 std::vector<VECTOR2I> corners = shape->GetRectCorners();
200 if( corners.size() == 4 )
215 aOutline.
Append( polyShape );
249 for(
int i = 0; i < 4; ++i )
253 aOutline.
Append( corners[i] );
287 aOutline.
Append( courtyard );
292 else if( extLayer ==
F_Fab || extLayer ==
B_Fab )
303 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ), wxT(
"Extrusion: no shapes found on explicit layer for '%s'" ),
316 aOutline.
Append( courtyard );
321 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ), wxT(
"Extrusion: courtyard outline failed for '%s', trying fab layer" ),
327 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ),
328 wxT(
"Extrusion: fab layer outline failed for '%s', trying silkscreen" ),
336 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ),
337 wxT(
"Extrusion: silkscreen outline failed for '%s', trying pad bbox" ),
343 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ), wxT(
"Extrusion: no outline could be generated for '%s'" ),
356 int shrink = -
pad->GetDrillSize().x / 20;
377 return { aDiffuse * 0.15f, aDiffuse * 0.5f +
SFVEC3F( 0.4f, 0.4f, 0.4f ), 0.5f * 128.0f };
379 return { aDiffuse * 0.1f, aDiffuse * 0.75f +
SFVEC3F( 0.25f, 0.25f, 0.25f ), 0.4f * 128.0f };
void ApplyExtrusionTransform(SHAPE_POLY_SET &aOutline, const EXTRUDED_3D_BODY *aBody, const VECTOR2I &aFpPos)
Apply 2D extrusion transforms (rotation, scale, offset) to an outline.
EXTRUSION_MATERIAL_PROPS GetMaterialProps(EXTRUSION_MATERIAL aMaterial, const SFVEC3F &aDiffuse)
bool GetExtrusionPinOutline(const FOOTPRINT *aFootprint, SHAPE_POLY_SET &aPinPoly)
Get the pin outline polygons for extruded THT pin rendering.
static bool buildFilledPolygonFromShapes(const FOOTPRINT *aFootprint, PCB_LAYER_ID aLayer, SHAPE_POLY_SET &aOutline)
Build a filled polygon from shapes on the given layer.
static bool buildPadBoundingBox(const FOOTPRINT *aFootprint, SHAPE_POLY_SET &aOutline)
bool GetExtrusionOutline(const FOOTPRINT *aFootprint, SHAPE_POLY_SET &aOutline, PCB_LAYER_ID aLayerOverride)
Get the extrusion outline polygon for a footprint in board coordinates.
BOX2I CalcPlaceholderLocalBox(const FOOTPRINT *aFootprint)
Calculate a local space bounding box for a placeholder 3D model.
constexpr int ARC_HIGH_DEF
constexpr EDA_IU_SCALE pcbIUScale
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
constexpr void SetOrigin(const Vec &pos)
constexpr size_type GetWidth() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr void SetSize(const SizeVec &size)
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr const Vec & GetOrigin() const
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
Represent a set of closed polygons.
void Rotate(const EDA_ANGLE &aAngle, const VECTOR2I &aCenter={ 0, 0 }) override
Rotate all vertices by a given angle.
void RemoveAllContours()
Remove all outlines & holes (clears) the polygon set.
void Scale(double aScaleFactorX, double aScaleFactorY, const VECTOR2I &aCenter)
int AddOutline(const SHAPE_LINE_CHAIN &aOutline)
Adds a new outline to the set and returns its index.
int Append(int x, int y, int aOutline=-1, int aHole=-1, bool aAllowDuplication=false)
Appends a vertex at the end of the given outline/hole (default: the last outline)
void Simplify()
Simplify the polyset (merges overlapping polys, eliminates degeneracy/self-intersections)
int NewOutline()
Creates a new empty polygon in the set and returns its index.
int OutlineCount() const
Return the number of outlines in the set.
void Move(const VECTOR2I &aVector) override
const SHAPE_LINE_CHAIN & COutline(int aIndex) const
void TransformCircleToPolygon(SHAPE_LINE_CHAIN &aBuffer, const VECTOR2I &aCenter, int aRadius, int aError, ERROR_LOC aErrorLoc, int aMinSegCount=0)
Convert a circle to a polygon, using multiple straight lines.
bool ConvertOutlineToPolygon(std::vector< PCB_SHAPE * > &aShapeList, SHAPE_POLY_SET &aPolygons, int aErrorMax, int aChainingEpsilon, bool aAllowDisjoint, OUTLINE_ERROR_HANDLER *aErrorHandler, bool aAllowUseArcsInPolygons)
Build a polygon set with holes from a PCB_SHAPE list.
@ RECTANGLE
Use RECTANGLE instead of RECT to avoid collision in a Windows header.
PCB_LAYER_ID FlipLayer(PCB_LAYER_ID aLayerId, int aCopperLayersCount)
PCB_LAYER_ID
A quick note on layer IDs:
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
VECTOR2< int32_t > VECTOR2I