diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.h b/3d-viewer/3d_canvas/cinfo3d_visu.h index 0660a06416..ffc7d53846 100644 --- a/3d-viewer/3d_canvas/cinfo3d_visu.h +++ b/3d-viewer/3d_canvas/cinfo3d_visu.h @@ -494,12 +494,10 @@ class CINFO3D_VISU void buildPadShapePolygon( const D_PAD *aPad, SHAPE_POLY_SET &aCornerBuffer, - wxSize aInflateValue, - int aSegmentsPerCircle, - double aCorrectionFactor ) const; + wxSize aInflateValue ) const; - public: +public: SFVEC3D m_BgColorBot; ///< background bottom color SFVEC3D m_BgColorTop; ///< background top color SFVEC3D m_BoardBodyColor; ///< in realistic mode: FR4 board color @@ -509,7 +507,7 @@ class CINFO3D_VISU SFVEC3D m_CopperColor; ///< in realistic mode: copper color - private: +private: /// Current board BOARD *m_board; diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 6259452d06..2e75007696 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -486,13 +486,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter ) continue; // Add the track contour - int nrSegments = GetNrSegmentsCircle( track->GetWidth() ); - - track->TransformShapeWithClearanceToPolygon( - *layerPoly, - 0, - nrSegments, - GetCircleCorrectionFactor( nrSegments ) ); + track->TransformShapeWithClearanceToPolygon( *layerPoly, 0 ); } } } diff --git a/3d-viewer/3d_canvas/create_layer_poly.cpp b/3d-viewer/3d_canvas/create_layer_poly.cpp index f4add3f547..f9d3e9124e 100644 --- a/3d-viewer/3d_canvas/create_layer_poly.cpp +++ b/3d-viewer/3d_canvas/create_layer_poly.cpp @@ -40,9 +40,7 @@ // but it adds the rect/trapezoid shapes with a different winding void CINFO3D_VISU::buildPadShapePolygon( const D_PAD* aPad, SHAPE_POLY_SET& aCornerBuffer, - wxSize aInflateValue, - int aSegmentsPerCircle, - double aCorrectionFactor ) const + wxSize aInflateValue ) const { wxPoint corners[4]; 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 ); wxSize new_size = aPad->GetSize() + aInflateValue + aInflateValue; dummy.SetSize( new_size ); - dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0, - aSegmentsPerCircle, aCorrectionFactor ); + dummy.TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 ); } break; @@ -90,8 +87,17 @@ void CINFO3D_VISU::buildPadShapePolygon( const D_PAD* aPad, case PAD_SHAPE_CUSTOM: { 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() ); aPad->CustomShapeAsPolygonToBoardPosition( &polyList, aPad->ShapePos(), aPad->GetOrientation() ); + + if( inflate_val > 0 ) + { + int numSegs = GetNrSegmentsCircle( inflate_val ); + polyList.Inflate( inflate_val, numSegs ); + } + aCornerBuffer.Append( polyList ); } break; @@ -117,11 +123,9 @@ void CINFO3D_VISU::buildPadShapeThickOutlineAsPolygon( const D_PAD* aPad, // For other shapes, draw polygon outlines SHAPE_POLY_SET corners; - unsigned int nr_sides_per_circle = GetNrSegmentsCircle( glm::min( aPad->GetSize().x, - aPad->GetSize().y) ); - buildPadShapePolygon( aPad, corners, wxSize( 0, 0 ), - nr_sides_per_circle, - GetCircleCorrectionFactor( nr_sides_per_circle ) ); + auto nr_sides_per_circle = + GetNrSegmentsCircle( std::min( aPad->GetSize().x, aPad->GetSize().y ) ); + buildPadShapePolygon( aPad, corners, wxSize( 0, 0 ) ); // Add outlines as thick segments in polygon buffer @@ -200,11 +204,7 @@ void CINFO3D_VISU::transformPadsShapesWithClearanceToPolygon( const DLIST break; } - unsigned int aCircleToSegmentsCount = GetNrSegmentsCircle( pad->GetSize().x ); - double aCorrectionFactor = GetCircleCorrectionFactor( aCircleToSegmentsCount ); - - buildPadShapePolygon( pad, aCornerBuffer, margin, - aCircleToSegmentsCount, aCorrectionFactor ); + buildPadShapePolygon( pad, aCornerBuffer, margin ); } } @@ -225,15 +225,7 @@ void CINFO3D_VISU::transformGraphicModuleEdgeToPolygonSet( const MODULE *aModule if( outline->GetLayer() != aLayer ) break; - unsigned int aCircleToSegmentsCount = - GetNrSegmentsCircle( outline->GetBoundingBox().GetSizeMax() ); - - double aCorrectionFactor = GetCircleCorrectionFactor( aCircleToSegmentsCount ); - - outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, - 0, - aCircleToSegmentsCount, - aCorrectionFactor ); + outline->TransformShapeWithClearanceToPolygon( aCornerBuffer, 0 ); } break;