Function CreateThermalReliefPadPolygon Add holes around a pad to create a thermal relief copper thickness is min (dx/2, aCopperWitdh) or min (dy/2, aCopperWitdh)
877 wxSize copper_thickness;
879 double delta = 3600.0 / aCircleToSegmentsCount;
885 aThermalGap += aMinThicknessValue / 2;
891 aCopperThickness -= aMinThicknessValue;
893 if( aCopperThickness < 0 )
894 aCopperThickness = 0;
899 copper_thickness.x =
std::min( dx, aCopperThickness );
900 copper_thickness.y =
std::min( dy, aCopperThickness );
920 std::vector <wxPoint> corners_buffer;
923 int outer_radius =
KiROUND( (dx + aThermalGap) * aCorrectionFactor );
926 corners_buffer.push_back(
wxPoint( copper_thickness.x / 2, copper_thickness.y / 2 ) );
930 corner.
x = copper_thickness.x / 2;
931 int y = outer_radius - (aThermalGap / 4);
932 corner.
y =
KiROUND( sqrt( ( (
double) y * y - (
double) corner.
x * corner.
x ) ) );
934 if( aThermalRot != 0 )
935 corners_buffer.push_back( corner );
938 corner.
x = copper_thickness.x / 2;
940 corner.
y =
KiROUND( sqrt( ( (
double) outer_radius * outer_radius ) -
941 ( (
double) corner.
x * corner.
x ) ) );
945 corner_end.
x = corner.
y;
946 corner_end.
y = corner.
x;
949 while( (corner.
y > corner_end.
y) && (corner.
x < corner_end.
x) )
951 corners_buffer.push_back( corner );
955 corners_buffer.push_back( corner_end );
960 corner.
x = corners_buffer[1].y;
961 corner.
y = corners_buffer[1].x;
962 corners_buffer.push_back( corner );
967 double th_angle = aThermalRot;
969 for(
unsigned ihole = 0; ihole < 4; ihole++ )
973 for(
unsigned ii = 0; ii < corners_buffer.size(); ii++ )
975 corner = corners_buffer[ii];
977 corner += padShapePos;
978 aCornerBuffer.
Append( corner.
x, corner.
y );
989 std::vector <wxPoint> corners_buffer;
991 dx = (aPad.
GetSize().x / 2) + aThermalGap;
992 dy = (aPad.
GetSize().y / 2) + aThermalGap;
1002 std::swap( dx, dy );
1004 std::swap( copper_thickness.x, copper_thickness.y );
1007 int deltasize = dx - dy;
1010 int outer_radius = dy;
1013 shape_offset =
wxPoint( deltasize, 0 );
1016 corner.
x = copper_thickness.x / 2;
1017 corner.
y = copper_thickness.y / 2;
1018 corners_buffer.push_back( corner );
1022 if( copper_thickness.x > deltasize )
1024 corner.
x = copper_thickness.x / 2;
1025 corner.
y =
KiROUND( sqrt( ( (
double) outer_radius * outer_radius ) -
1026 ( (
double) ( corner.
x - delta ) * ( corner.
x - deltasize ) ) ) );
1027 corner.
x -= deltasize;
1033 intpoint.
y -= aThermalGap / 4;
1034 corners_buffer.push_back( intpoint + shape_offset );
1039 corner.
x = copper_thickness.x / 2;
1040 corner.
y = outer_radius;
1041 corners_buffer.push_back( corner );
1047 last_corner.
y = copper_thickness.y / 2;
1048 int px = outer_radius - (aThermalGap / 4);
1050 KiROUND( sqrt( ( ( (
double) px * px ) - (
double) last_corner.
y * last_corner.
y ) ) );
1053 corner_end.
y = copper_thickness.y / 2;
1055 KiROUND( sqrt( ( (
double) outer_radius *
1056 outer_radius ) - ( (
double) corner_end.
y * corner_end.
y ) ) );
1060 while( (corner.
y > corner_end.
y) && (corner.
x < corner_end.
x) )
1062 corners_buffer.push_back( corner + shape_offset );
1067 corners_buffer.push_back( corner_end + shape_offset );
1068 corners_buffer.push_back( last_corner + shape_offset );
1074 for(
int irect = 0; irect < 2; irect++ )
1077 for(
unsigned ic = 0; ic < corners_buffer.size(); ic++ )
1079 wxPoint cpos = corners_buffer[ic];
1081 cpos += padShapePos;
1082 aCornerBuffer.
Append( cpos.
x, cpos.
y );
1089 for(
unsigned ic = 0; ic < corners_buffer.size(); ic++ )
1091 wxPoint swap = corners_buffer[ic];
1093 corners_buffer[ic] = swap;
1099 for(
int irect = 0; irect < 2; irect++ )
1103 for(
unsigned ic = 0; ic < corners_buffer.size(); ic++ )
1105 wxPoint cpos = corners_buffer[ic];
1107 cpos += padShapePos;
1108 aCornerBuffer.
Append( cpos.
x, cpos.
y );
1142 std::vector <wxPoint> corners_buffer;
1144 dx = (aPad.
GetSize().x / 2) + aThermalGap;
1145 dy = (aPad.
GetSize().y / 2) + aThermalGap;
1150 corners_buffer.push_back(
wxPoint( -dx, -(aThermalGap / 4 + copper_thickness.y / 2) ) );
1151 corners_buffer.push_back(
wxPoint( -(dx - aThermalGap / 4), -copper_thickness.y / 2 ) );
1152 corners_buffer.push_back(
wxPoint( -copper_thickness.x / 2, -copper_thickness.y / 2 ) );
1153 corners_buffer.push_back(
wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) );
1154 corners_buffer.push_back(
wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) );
1157 int rounding_radius =
KiROUND( aThermalGap * aCorrectionFactor );
1159 for(
int i = 0;
i < aCircleToSegmentsCount / 4 + 1;
i++ )
1164 RotatePoint( &corner_position, 1800.0 / aCircleToSegmentsCount );
1165 double angle_pg =
i *
delta;
1168 corner_position -= aPad.
GetSize() / 2;
1170 corners_buffer.push_back(
wxPoint( corner_position.
x, corner_position.
y ) );
1173 for(
int irect = 0; irect < 2; irect++ )
1177 for(
unsigned ic = 0; ic < corners_buffer.size(); ic++ )
1179 wxPoint cpos = corners_buffer[ic];
1181 cpos += padShapePos;
1182 aCornerBuffer.
Append( cpos.
x, cpos.
y );
1189 for(
unsigned ic = 0; ic < corners_buffer.size(); ic++ )
1191 wxPoint swap = corners_buffer[ic];
1193 corners_buffer[ic] = swap;
1197 for(
int irect = 0; irect < 2; irect++ )
1201 for(
unsigned ic = 0; ic < corners_buffer.size(); ic++ )
1203 wxPoint cpos = corners_buffer[ic];
1205 cpos += padShapePos;
1206 aCornerBuffer.
Append( cpos.
x, cpos.
y );
1224 aCircleToSegmentsCount, aCorrectionFactor );
1237 stubBuffer[0].
x = stub_len;
1238 stubBuffer[0].
y = copper_thickness.y/2;
1239 stubBuffer[1] = stubBuffer[0];
1240 stubBuffer[1].
y = -copper_thickness.y/2;
1241 stubBuffer[2] = stubBuffer[1];
1242 stubBuffer[2].
x = -stub_len;
1243 stubBuffer[3] = stubBuffer[2];
1244 stubBuffer[3].
y = copper_thickness.y/2;
1248 for(
unsigned ii = 0; ii <
DIM( stubBuffer ); ii++ )
1250 wxPoint cpos = stubBuffer[ii];
1252 cpos += padShapePos;
1253 stub.
Append( cpos.x, cpos.y );
1258 stubBuffer[0].
y = stub_len;
1259 stubBuffer[0].
x = copper_thickness.x/2;
1260 stubBuffer[1] = stubBuffer[0];
1261 stubBuffer[1].
x = -copper_thickness.x/2;
1262 stubBuffer[2] = stubBuffer[1];
1263 stubBuffer[2].
y = -stub_len;
1264 stubBuffer[3] = stubBuffer[2];
1265 stubBuffer[3].
x = copper_thickness.x/2;
1270 for(
unsigned ii = 0; ii <
DIM( stubBuffer ); ii++ )
1272 wxPoint cpos = stubBuffer[ii];
1274 cpos += padShapePos;
1275 stub.
Append( cpos.x, cpos.y );
1282 aCornerBuffer.
Append( antipad );
#define DIM(x)
of elements in an array
static int KiROUND(double v)
KiROUND rounds a floating point number to an int using "round halfway cases away from zero"...
void RotatePoint(int *pX, int *pY, double angle)
PAD_SHAPE_T GetShape() const
Function GetShape.
static const int delta[8][2]
T AddAngles(T a1, T2 a2)
Add two angles (keeping the result normalized). T2 is here.
const wxSize & GetSize() const
void Simplify(POLYGON_MODE aFastMode)
Simplifies the polyset (merges overlapping polys, eliminates degeneracy/self-intersections) For aFast...
void TransformShapeWithClearanceToPolygon(SHAPE_POLY_SET &aCornerBuffer, int aClearanceValue, int aCircleToSegmentsCount, double aCorrectionFactor) const override
Function TransformShapeWithClearanceToPolygon Convert the pad shape to a closed polygon Used in filli...
int NewOutline()
Creates a new empty polygon in the set and returns its index
static DIRECTION_45::AngleType angle(const VECTOR2I &a, const VECTOR2I &b)
void RemoveAllContours()
Removes all outlines & holes (clears) the polygon set.
double GetOrientation() const
Function GetOrientation returns the rotation angle of the pad in tenths of degrees, but soon degrees.
Class EDA_RECT handles the component boundary box.
void BooleanSubtract(const SHAPE_POLY_SET &b, POLYGON_MODE aFastMode)
Performs boolean polyset difference For aFastMode meaning, see function booleanOp ...
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes...
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) ...