37 bool hasLocalBounds =
false;
51 hasLocalBounds =
true;
55 localBox.
Merge( padBox );
71 BOX2I itemBox = item->GetBoundingBox();
80 for(
int ci = 0; ci < 4; ++ci )
97 localBox = localItemBox;
98 hasLocalBounds =
true;
102 localBox.
Merge( localItemBox );
108 if( !hasLocalBounds )
129 std::vector<PCB_SHAPE*> closedShapes;
130 std::vector<PCB_SHAPE*> openShapes;
134 if( item->GetLayer() == aLayer && item->Type() ==
PCB_SHAPE_T )
141 closedShapes.push_back( shape );
145 openShapes.push_back( shape );
150 if( closedShapes.empty() && openShapes.empty() )
155 if( !openShapes.empty() )
157 int chainingEpsilon =
pcbIUScale.mmToIU( 0.02 );
171 shape->TransformShapeToPolygon( strokes, aLayer, 0, maxError,
ERROR_INSIDE );
183 for(
const PCB_SHAPE* shape : closedShapes )
185 switch( shape->GetShape() )
194 std::vector<VECTOR2I> corners = shape->GetRectCorners();
196 if( corners.size() == 4 )
211 aOutline.
Append( polyShape );
245 for(
int i = 0; i < 4; ++i )
249 aOutline.
Append( corners[i] );
283 aOutline.
Append( courtyard );
288 else if( extLayer ==
F_Fab || extLayer ==
B_Fab )
299 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ), wxT(
"Extrusion: no shapes found on explicit layer for '%s'" ),
312 aOutline.
Append( courtyard );
317 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ), wxT(
"Extrusion: courtyard outline failed for '%s', trying fab layer" ),
323 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ),
324 wxT(
"Extrusion: fab layer outline failed for '%s', trying silkscreen" ),
332 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ),
333 wxT(
"Extrusion: silkscreen outline failed for '%s', trying pad bbox" ),
339 wxLogTrace( wxT(
"KI_TRACE_3D_RENDER" ), wxT(
"Extrusion: no outline could be generated for '%s'" ),
352 int shrink = -
pad->GetDrillSize().x / 20;
373 return { aDiffuse * 0.15f, aDiffuse * 0.5f +
SFVEC3F( 0.4f, 0.4f, 0.4f ), 0.5f * 128.0f };
375 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