3d-viewer: Fix a couple missing arc counts

This commit is contained in:
Seth Hillbrand 2019-05-17 06:16:15 -07:00
parent f32c95229e
commit f347815150
3 changed files with 20 additions and 36 deletions

View File

@ -494,9 +494,7 @@ class CINFO3D_VISU
void buildPadShapePolygon( const D_PAD *aPad, void buildPadShapePolygon( const D_PAD *aPad,
SHAPE_POLY_SET &aCornerBuffer, SHAPE_POLY_SET &aCornerBuffer,
wxSize aInflateValue, wxSize aInflateValue ) const;
int aSegmentsPerCircle,
double aCorrectionFactor ) const;
public: public:

View File

@ -486,13 +486,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
continue; continue;
// Add the track contour // Add the track contour
int nrSegments = GetNrSegmentsCircle( track->GetWidth() ); track->TransformShapeWithClearanceToPolygon( *layerPoly, 0 );
track->TransformShapeWithClearanceToPolygon(
*layerPoly,
0,
nrSegments,
GetCircleCorrectionFactor( nrSegments ) );
} }
} }
} }

View File

@ -40,9 +40,7 @@
// but it adds the rect/trapezoid shapes with a different winding // but it adds the rect/trapezoid shapes with a different winding
void CINFO3D_VISU::buildPadShapePolygon( const D_PAD* aPad, void CINFO3D_VISU::buildPadShapePolygon( const D_PAD* aPad,
SHAPE_POLY_SET& aCornerBuffer, SHAPE_POLY_SET& aCornerBuffer,
wxSize aInflateValue, wxSize aInflateValue ) const
int aSegmentsPerCircle,
double aCorrectionFactor ) const
{ {
wxPoint corners[4]; wxPoint corners[4];
wxPoint PadShapePos = aPad->ShapePos(); /* Note: for pad having a shape offset, wxPoint PadShapePos = aPad->ShapePos(); /* Note: for pad having a shape offset,
@ -63,8 +61,7 @@ void CINFO3D_VISU::buildPadShapePolygon( const D_PAD* aPad,
D_PAD dummy( *aPad ); D_PAD dummy( *aPad );
wxSize new_size = aPad->GetSize() + aInflateValue + aInflateValue; wxSize new_size = aPad->GetSize() + aInflateValue + aInflateValue;
dummy.SetSize( new_size ); dummy.SetSize( new_size );
dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0, dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 );
aSegmentsPerCircle, aCorrectionFactor );
} }
break; break;
@ -90,8 +87,17 @@ void CINFO3D_VISU::buildPadShapePolygon( const D_PAD* aPad,
case PAD_SHAPE_CUSTOM: case PAD_SHAPE_CUSTOM:
{ {
SHAPE_POLY_SET polyList; // Will contain the pad outlines in board coordinates SHAPE_POLY_SET polyList; // Will contain the pad outlines in board coordinates
auto inflate_val = std::max( aInflateValue.x, aInflateValue.y );
polyList.Append( aPad->GetCustomShapeAsPolygon() ); polyList.Append( aPad->GetCustomShapeAsPolygon() );
aPad->CustomShapeAsPolygonToBoardPosition( &polyList, aPad->ShapePos(), aPad->GetOrientation() ); aPad->CustomShapeAsPolygonToBoardPosition( &polyList, aPad->ShapePos(), aPad->GetOrientation() );
if( inflate_val > 0 )
{
int numSegs = GetNrSegmentsCircle( inflate_val );
polyList.Inflate( inflate_val, numSegs );
}
aCornerBuffer.Append( polyList ); aCornerBuffer.Append( polyList );
} }
break; break;
@ -117,11 +123,9 @@ void CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon( const D_PAD* aPad,
// For other shapes, draw polygon outlines // For other shapes, draw polygon outlines
SHAPE_POLY_SET corners; SHAPE_POLY_SET corners;
unsigned int nr_sides_per_circle = GetNrSegmentsCircle( glm::min( aPad->GetSize().x, auto nr_sides_per_circle =
aPad->GetSize().y) ); GetNrSegmentsCircle( std::min( aPad->GetSize().x, aPad->GetSize().y ) );
buildPadShapePolygon( aPad, corners, wxSize( 0, 0 ), buildPadShapePolygon( aPad, corners, wxSize( 0, 0 ) );
nr_sides_per_circle,
GetCircleCorrectionFactor( nr_sides_per_circle ) );
// Add outlines as thick segments in polygon buffer // Add outlines as thick segments in polygon buffer
@ -200,11 +204,7 @@ void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const DLIST<D_PAD>
break; break;
} }
unsigned int aCircleToSegmentsCount = GetNrSegmentsCircle( pad->GetSize().x ); buildPadShapePolygon( pad, aCornerBuffer, margin );
double aCorrectionFactor = GetCircleCorrectionFactor( aCircleToSegmentsCount );
buildPadShapePolygon( pad, aCornerBuffer, margin,
aCircleToSegmentsCount, aCorrectionFactor );
} }
} }
@ -225,15 +225,7 @@ void CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule
if( outline->GetLayer() != aLayer ) if( outline->GetLayer() != aLayer )
break; break;
unsigned int aCircleToSegmentsCount = outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 );
GetNrSegmentsCircle( outline->GetBoundingBox().GetSizeMax() );
double aCorrectionFactor = GetCircleCorrectionFactor( aCircleToSegmentsCount );
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer,
0,
aCircleToSegmentsCount,
aCorrectionFactor );
} }
break; break;