pcbnew: Replace magic number segment counts
Where we set 32 segments per circle, the magic number is replaced by the same value as the common define ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF
This commit is contained in:
parent
847f6ab4b3
commit
c92424898c
|
@ -884,7 +884,7 @@ bool D_PAD::HitTest( const wxPoint& aPosition ) const
|
|||
{
|
||||
// Check for hit in polygon
|
||||
SHAPE_POLY_SET outline;
|
||||
const int segmentToCircleCount = 32;
|
||||
const int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
TransformRoundRectToPolygon( outline, wxPoint(0,0), GetSize(), m_Orient,
|
||||
GetRoundRectCornerRadius(), segmentToCircleCount );
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#ifndef PAD_H_
|
||||
#define PAD_H_
|
||||
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <class_board_item.h>
|
||||
#include <board_connected_item.h>
|
||||
#include <pad_shapes.h>
|
||||
|
@ -308,7 +308,7 @@ public:
|
|||
* Note: The corners coordinates are relative to the pad position, orientation 0,
|
||||
*/
|
||||
bool MergePrimitivesAsPolygon( SHAPE_POLY_SET * aMergedPolygon = NULL,
|
||||
int aCircleToSegmentsCount = 32 );
|
||||
int aCircleToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
|
||||
|
||||
/**
|
||||
* clear the basic shapes list
|
||||
|
|
|
@ -1173,7 +1173,7 @@ ZONE_CONTAINER* EAGLE_PLUGIN::loadPolygon( wxXmlNode* aPolyNode )
|
|||
zone->SetHatch( ZONE_CONTAINER::DIAGONAL_EDGE, zone->GetDefaultHatchPitch(), true );
|
||||
|
||||
// clearances, etc.
|
||||
zone->SetArcSegmentCount( 32 ); // @todo: should be a constructor default?
|
||||
zone->SetArcSegmentCount( ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF ); // @todo: should be a constructor default?
|
||||
zone->SetMinThickness( std::max<int>(
|
||||
ZONE_THICKNESS_MIN_VALUE_MIL*IU_PER_MILS, p.width.ToPcbUnits() ) );
|
||||
|
||||
|
|
|
@ -679,7 +679,7 @@ static void export_vrml_arc( MODEL_VRML& aModel, LAYER_NUM layer,
|
|||
static void export_vrml_polygon( MODEL_VRML& aModel, LAYER_NUM layer,
|
||||
DRAWSEGMENT *aOutline, double aOrientation, wxPoint aPos )
|
||||
{
|
||||
const int circleSegmentsCount = 32;
|
||||
const int circleSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
|
||||
if( aOutline->IsPolyShapeValid() )
|
||||
{
|
||||
|
@ -1118,7 +1118,7 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P
|
|||
case PAD_SHAPE_ROUNDRECT:
|
||||
{
|
||||
SHAPE_POLY_SET polySet;
|
||||
int segmentToCircleCount = 32;
|
||||
int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
const int corner_radius = aPad->GetRoundRectCornerRadius( aPad->GetSize() );
|
||||
TransformRoundRectToPolygon( polySet, wxPoint( 0, 0 ), aPad->GetSize(),
|
||||
0.0, corner_radius, segmentToCircleCount );
|
||||
|
@ -1141,7 +1141,7 @@ static void export_vrml_padshape( MODEL_VRML& aModel, VRML_LAYER* aTinLayer, D_P
|
|||
case PAD_SHAPE_CUSTOM:
|
||||
{
|
||||
SHAPE_POLY_SET polySet;
|
||||
int segmentToCircleCount = 32;
|
||||
int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
std::vector< wxRealPoint > cornerList;
|
||||
aPad->MergePrimitivesAsPolygon( &polySet, segmentToCircleCount );
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ bool D_PAD::buildCustomPadPolygon( SHAPE_POLY_SET* aMergedPolygon,
|
|||
polyset.Append( poly[ii].x, poly[ii].y );
|
||||
}
|
||||
|
||||
polyset.Inflate( bshape.m_Thickness/2, 32 );
|
||||
polyset.Inflate( bshape.m_Thickness/2, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
|
||||
|
||||
aux_polyset.Append( polyset );
|
||||
}
|
||||
|
|
|
@ -418,9 +418,8 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
|||
|
||||
if( aDrawInfo.m_PadClearance )
|
||||
{
|
||||
#define SEGCOUNT 32 // number of segments to approximate a circle
|
||||
SHAPE_POLY_SET outline;
|
||||
TransformShapeWithClearanceToPolygon( outline, aDrawInfo.m_PadClearance, SEGCOUNT, 1.0 );
|
||||
TransformShapeWithClearanceToPolygon( outline, aDrawInfo.m_PadClearance, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF, 1.0 );
|
||||
|
||||
// Draw the polygon: Inflate creates only one convex polygon
|
||||
if( outline.OutlineCount() > 0 )
|
||||
|
@ -483,7 +482,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
|||
corner_radius = GetRoundRectCornerRadius() + aDrawInfo.m_PadClearance;
|
||||
|
||||
TransformRoundRectToPolygon( outline, shape_pos, size, GetOrientation(),
|
||||
corner_radius, 32 );
|
||||
corner_radius, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
|
||||
|
||||
if( outline.OutlineCount() > 0 )
|
||||
{
|
||||
|
@ -544,7 +543,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
|||
CustomShapeAsPolygonToBoardPosition( &outline, pad_pos, GetOrientation() );
|
||||
SHAPE_LINE_CHAIN* poly;
|
||||
|
||||
const int segmentToCircleCount = 32;
|
||||
const int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
|
||||
if( aDrawInfo.m_Mask_margin.x )
|
||||
{
|
||||
|
|
|
@ -855,7 +855,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
{
|
||||
SHAPE_POLY_SET outline;
|
||||
outline.Append( aPad->GetCustomShapeAsPolygon() );
|
||||
const int segmentToCircleCount = 32;
|
||||
const int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
outline.Inflate( custom_margin, segmentToCircleCount );
|
||||
m_gal->DrawPolygon( outline );
|
||||
}
|
||||
|
|
|
@ -461,7 +461,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
|||
D_PAD dummy( *pad );
|
||||
SHAPE_POLY_SET shape;
|
||||
pad->MergePrimitivesAsPolygon( &shape, 64 );
|
||||
shape.Inflate( margin.x, 32 );
|
||||
shape.Inflate( margin.x, ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
|
||||
dummy.DeletePrimitivesList();
|
||||
dummy.AddPrimitive( shape, 0 );
|
||||
dummy.MergePrimitivesAsPolygon();
|
||||
|
@ -817,7 +817,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
|||
/* calculates the coeff to compensate radius reduction of holes clearance
|
||||
* due to the segment approx ( 1 /cos( PI/circleToSegmentsCount )
|
||||
*/
|
||||
int circleToSegmentsCount = 32;
|
||||
int circleToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
double correction = GetCircletoPolyCorrectionFactor( circleToSegmentsCount );
|
||||
|
||||
// Plot pads
|
||||
|
@ -895,7 +895,7 @@ void PlotSolderMaskLayer( BOARD *aBoard, PLOTTER* aPlotter,
|
|||
// However it is not complex, and fast enough for plot purposes (copy/convert data
|
||||
// is only a very small calculation time for these calculations)
|
||||
ZONE_CONTAINER zone( aBoard );
|
||||
zone.SetArcSegmentCount( 32 );
|
||||
zone.SetArcSegmentCount( ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF );
|
||||
zone.SetMinThickness( 0 ); // trace polygons only
|
||||
zone.SetLayer ( layer );
|
||||
|
||||
|
|
|
@ -711,7 +711,7 @@ std::unique_ptr<PNS::SOLID> PNS_KICAD_IFACE::syncPad( D_PAD* aPad )
|
|||
case PAD_SHAPE_ROUNDRECT:
|
||||
{
|
||||
SHAPE_POLY_SET outline;
|
||||
const int segmentToCircleCount = 32;
|
||||
const int segmentToCircleCount = ARC_APPROX_SEGMENTS_COUNT_HIGH_DEF;
|
||||
aPad->BuildPadShapePolygon( outline, wxSize( 0, 0 ),
|
||||
segmentToCircleCount, 1.0 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue