diff --git a/3d-viewer/3d_draw_basic_functions.cpp b/3d-viewer/3d_draw_basic_functions.cpp index 632706024e..c87500dfff 100644 --- a/3d-viewer/3d_draw_basic_functions.cpp +++ b/3d-viewer/3d_draw_basic_functions.cpp @@ -370,7 +370,7 @@ void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd, void Draw3D_ArcSegment( const wxPoint& aCenterPos, const wxPoint& aStartPoint, - int aArcAngle, int aWidth, int aThickness, + double aArcAngle, int aWidth, int aThickness, int aZpos, double aBiuTo3DUnits ) { const int slice = SEGM_PER_CIRCLE; diff --git a/3d-viewer/3d_draw_basic_functions.h b/3d-viewer/3d_draw_basic_functions.h index 66117ce63b..9f40bc0821 100644 --- a/3d-viewer/3d_draw_basic_functions.h +++ b/3d-viewer/3d_draw_basic_functions.h @@ -85,7 +85,7 @@ void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd, * @param aBiuTo3DUnits = board internal units to 3D units scaling value */ void Draw3D_ArcSegment( const wxPoint& aCenterPos, const wxPoint& aStartPoint, - int aArcAngle, int aWidth, int aThickness, + double aArcAngle, int aWidth, int aThickness, int aZpos, double aBiuTo3DUnits ); diff --git a/common/class_plotter.cpp b/common/class_plotter.cpp index 4958ade889..af5c68df10 100644 --- a/common/class_plotter.cpp +++ b/common/class_plotter.cpp @@ -111,33 +111,29 @@ double PLOTTER::userToDeviceSize( double size ) /** * Generic fallback: arc rendered as a polyline */ -void PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius, +void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ) { wxPoint start, end; const int delta = 50; // increment (in 0.1 degrees) to draw circles - double alpha; if( StAngle > EndAngle ) EXCHG( StAngle, EndAngle ); SetCurrentLineWidth( width ); /* Please NOTE the different sign due to Y-axis flip */ - alpha = DEG2RAD( StAngle / 10.0 ); - start.x = centre.x + (int) ( radius * cos( -alpha ) ); - start.y = centre.y + (int) ( radius * sin( -alpha ) ); + start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) ); + start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) ); MoveTo( start ); for( int ii = StAngle + delta; ii < EndAngle; ii += delta ) { - alpha = DEG2RAD( ii / 10.0 ); - end.x = centre.x + (int) ( radius * cos( -alpha ) ); - end.y = centre.y + (int) ( radius * sin( -alpha ) ); + end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) ); + end.y = centre.y + KiROUND( sindecideg( radius, -ii ) ); LineTo( end ); } - alpha = DEG2RAD( EndAngle / 10.0 ); - end.x = centre.x + (int) ( radius * cos( -alpha ) ); - end.y = centre.y + (int) ( radius * sin( -alpha ) ); + end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) ); + end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) ); FinishTo( end ); } @@ -380,7 +376,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width { wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 ); wxSize size( end.x - start.x, end.y - start.y ); - int orient; + double orient; if( size.y == 0 ) orient = 0; @@ -396,7 +392,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width } -void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, int orient, +void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient, int width ) { SetCurrentLineWidth( width ); @@ -467,8 +463,8 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width, } -void PLOTTER::ThickArc( const wxPoint& centre, int StAngle, int EndAngle, int radius, - int width, EDA_DRAW_MODE_T tracemode ) +void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle, + int radius, int width, EDA_DRAW_MODE_T tracemode ) { switch( tracemode ) { diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp index 0001f88110..e76d6805c1 100644 --- a/common/common_plotDXF_functions.cpp +++ b/common/common_plotDXF_functions.cpp @@ -389,7 +389,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int /** Plot an arc in DXF format * Filling is not supported */ -void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius, +void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ) { wxASSERT( outputFile ); @@ -412,7 +412,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad /** * DXF oval pad: always done in sketch mode */ -void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient, +void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T trace_mode ) { wxASSERT( outputFile ); @@ -445,7 +445,7 @@ void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, * DXF rectangular pad: alwayd done in sketch mode */ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, - int orient, EDA_DRAW_MODE_T trace_mode ) + double orient, EDA_DRAW_MODE_T trace_mode ) { wxASSERT( outputFile ); wxSize size; @@ -513,7 +513,7 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, * DXF trapezoidal pad: only sketch mode is supported */ void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) { wxASSERT( outputFile ); wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */ @@ -555,7 +555,7 @@ bool containsNonAsciiChars( const wxString& string ) void DXF_PLOTTER::Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp index ed15f1d507..a32b824ece 100644 --- a/common/common_plotGERBER_functions.cpp +++ b/common/common_plotGERBER_functions.cpp @@ -282,7 +282,7 @@ void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill } -void GERBER_PLOTTER::Arc( const wxPoint& aCenter, int aStAngle, int aEndAngle, +void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, int aRadius, FILL_T aFill, int aWidth ) { wxASSERT( outputFile ); @@ -370,7 +370,7 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, /** * Filled oval flashes are handled as aperture in the 90 degree positions only */ -void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient, +void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T trace_mode ) { wxASSERT( outputFile ); @@ -427,7 +427,7 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int * Filled rect flashes are handled as aperture in the 90 degree positions only */ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, - int orient, EDA_DRAW_MODE_T trace_mode ) + double orient, EDA_DRAW_MODE_T trace_mode ) { wxASSERT( outputFile ); @@ -494,7 +494,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, * they require aperture macros */ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) { // XXX to do: use an aperture macro to declare the pad diff --git a/common/common_plotHPGL_functions.cpp b/common/common_plotHPGL_functions.cpp index 223b900679..15893dfeeb 100644 --- a/common/common_plotHPGL_functions.cpp +++ b/common/common_plotHPGL_functions.cpp @@ -381,7 +381,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, * PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, NbSegm; PU; * Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU; */ -void HPGL_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius, +void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ) { wxASSERT( outputFile ); @@ -419,7 +419,7 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int ra /* Plot oval pad. */ -void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient, +void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T trace_mode ) { wxASSERT( outputFile ); @@ -499,7 +499,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, - int orient, EDA_DRAW_MODE_T trace_mode ) + double orient, EDA_DRAW_MODE_T trace_mode ) { wxASSERT( outputFile ); wxSize size; @@ -616,7 +616,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize, void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) { wxASSERT( outputFile ); wxPoint polygone[4]; // coordinates of corners relatives to the pad diff --git a/common/common_plotPDF_functions.cpp b/common/common_plotPDF_functions.cpp index d48b716da1..b053121c48 100644 --- a/common/common_plotPDF_functions.cpp +++ b/common/common_plotPDF_functions.cpp @@ -201,7 +201,7 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi * The PDF engine can't directly plot arcs, it uses the base emulation. * So no filled arcs (not a great loss... ) */ -void PDF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius, +void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ) { wxASSERT( workFile ); @@ -735,7 +735,7 @@ bool PDF_PLOTTER::EndPlot() void PDF_PLOTTER::Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp index c94a2f5af8..2a0057e081 100644 --- a/common/common_plotPS_functions.cpp +++ b/common/common_plotPS_functions.cpp @@ -64,7 +64,7 @@ void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color ) } -void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient, +void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient, EDA_DRAW_MODE_T modetrace ) { wxASSERT( outputFile ); @@ -115,7 +115,7 @@ void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre, void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, - int orient, EDA_DRAW_MODE_T trace_mode ) + double orient, EDA_DRAW_MODE_T trace_mode ) { static std::vector< wxPoint > cornerList; wxSize size( aSize ); @@ -159,7 +159,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize, void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) { static std::vector< wxPoint > cornerList; cornerList.clear(); @@ -471,8 +471,8 @@ void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int widt } -void PS_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius, - FILL_T fill, int width ) +void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, + int radius, FILL_T fill, int width ) { wxASSERT( outputFile ); if( radius <= 0 ) @@ -805,7 +805,7 @@ bool PS_PLOTTER::EndPlot() void PS_PLOTTER::Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/common/common_plotSVG_functions.cpp b/common/common_plotSVG_functions.cpp index e6544489fd..03d53698b0 100644 --- a/common/common_plotSVG_functions.cpp +++ b/common/common_plotSVG_functions.cpp @@ -321,7 +321,7 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid } -void SVG_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius, +void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius, FILL_T fill, int width ) { /* Draws an arc of a circle, centred on (xc,yc), with starting point @@ -347,7 +347,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad if( !plotMirror ) { - int tmp = StAngle; + double tmp = StAngle; StAngle = -EndAngle; EndAngle = -tmp; } @@ -550,7 +550,7 @@ bool SVG_PLOTTER::EndPlot() void SVG_PLOTTER::Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/common/convert_basic_shapes_to_polygon.cpp b/common/convert_basic_shapes_to_polygon.cpp index 9ec4e425bb..ada3982593 100644 --- a/common/convert_basic_shapes_to_polygon.cpp +++ b/common/convert_basic_shapes_to_polygon.cpp @@ -174,8 +174,8 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer, startp = aEnd; } - int delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees - int seg_len = KiROUND( EuclideanNorm( endp ) ); + double delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees + int seg_len = KiROUND( EuclideanNorm( endp ) ); int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree @@ -237,7 +237,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer, * @param aWidth = width (thickness) of the line */ void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer, - wxPoint aCentre, wxPoint aStart, int aArcAngle, + wxPoint aCentre, wxPoint aStart, double aArcAngle, int aCircleToSegmentsCount, int aWidth ) { wxPoint arc_start, arc_end; diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp index 26f4f5bbf7..b7da2dc15f 100644 --- a/common/drawtxt.cpp +++ b/common/drawtxt.cpp @@ -266,7 +266,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, const wxPoint& aPos, EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -566,7 +566,7 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, enum EDA_COLOR_T aColor1, enum EDA_COLOR_T aColor2, const wxString &aText, - int aOrient, + double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -611,7 +611,7 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, void PLOTTER::Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index a5dbee6832..624ecc6642 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -746,7 +746,7 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, } else { - int delta_angle = ArcTangente( dy, dx ); + double delta_angle = ArcTangente( dy, dx ); dwx = 0; dwy = width; RotatePoint( &dwx, &dwy, -delta_angle ); @@ -1107,8 +1107,8 @@ void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, - int StAngle, - int EndAngle, + double StAngle, + double EndAngle, int r, int width, EDA_COLOR_T Color, @@ -1153,7 +1153,8 @@ void GRFilledArc( EDA_RECT* ClipBox, void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, - int StAngle, int EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor ) + double StAngle, double EndAngle, int r, + EDA_COLOR_T Color, EDA_COLOR_T BgColor ) { GRFilledArc( ClipBox, DC, x, y, StAngle, EndAngle, r, 0, Color, BgColor ); } @@ -1162,8 +1163,8 @@ void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, /* * Draw an arc in drawing space. */ -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int StAngle, - int EndAngle, int r, EDA_COLOR_T Color ) +void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, double StAngle, + double EndAngle, int r, EDA_COLOR_T Color ) { int x1, y1, x2, y2; @@ -1210,8 +1211,8 @@ void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, - int StAngle, - int EndAngle, + double StAngle, + double EndAngle, int r, int width, EDA_COLOR_T Color ) diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index e230423da0..6ab7aa4393 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -748,7 +748,7 @@ void LIB_ARC::calcEdit( const wxPoint& aPosition ) // artifacts left behind from the initial draw. int dx, dy; int cX, cY; - int angle; + double angle; cX = aPosition.x; cY = aPosition.y; diff --git a/gerbview/class_aperture_macro.cpp b/gerbview/class_aperture_macro.cpp index 450b9458fc..28dabd5e19 100644 --- a/gerbview/class_aperture_macro.cpp +++ b/gerbview/class_aperture_macro.cpp @@ -140,7 +140,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent, wxPoint curPos = aShapePos; D_CODE* tool = aParent->GetDcodeDescr(); - int rotation; + double rotation; if( mapExposure( aParent ) == false ) { EXCHG(aColor, aAltColor); @@ -272,7 +272,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent, for( int ii = 0; ii < 4; ii++ ) { subshape_poly = polybuffer; - int sub_rotation = rotation + 900 * ii; + double sub_rotation = rotation + 900 * ii; for( unsigned jj = 0; jj < subshape_poly.size(); jj++ ) RotatePoint( &subshape_poly[jj], -sub_rotation ); @@ -459,7 +459,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent, aBuffer.push_back( currpt ); // Rotate rectangle and move it to the actual start point - int angle = ArcTangente( delta.y, delta.x ); + double angle = ArcTangente( delta.y, delta.x ); for( unsigned ii = 0; ii < 4; ii++ ) { @@ -512,16 +512,15 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent, int outerRadius = scaletoIU( params[2].GetValue( tool ), m_GerbMetric ) / 2; int innerRadius = scaletoIU( params[3].GetValue( tool ), m_GerbMetric ) / 2; int halfthickness = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2; - int angle_start = RAD2DECIDEG( asin( (double) halfthickness / innerRadius ) ); + double angle_start = RAD2DECIDEG( asin( (double) halfthickness / innerRadius ) ); // Draw shape in the first cadrant (X and Y > 0) wxPoint pos, startpos; // Inner arc startpos.x = innerRadius; - int angle_end = 900 - angle_start; - int angle; - for( angle = angle_start; angle < angle_end; angle += 100 ) + double angle_end = 900 - angle_start; + for( double angle = angle_start; angle < angle_end; angle += 100 ) { pos = startpos; RotatePoint( &pos, angle ); @@ -540,7 +539,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent, angle_end = 900 - angle_start; // First point, near Y axis, outer arc - for( angle = angle_end; angle > angle_start; angle -= 100 ) + for( double angle = angle_end; angle > angle_start; angle -= 100 ) { pos = startpos; RotatePoint( &pos, angle ); diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp index 9def8a41e5..9bed410359 100644 --- a/gerbview/class_gerber_draw_item.cpp +++ b/gerbview/class_gerber_draw_item.cpp @@ -115,7 +115,7 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const abPos += m_layerOffset + m_imageParams->m_ImageOffset; abPos.x = KiROUND( abPos.x * m_drawScale.x ); abPos.y = KiROUND( abPos.y * m_drawScale.y ); - int rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10; + double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10; if( rotation ) RotatePoint( &abPos, -rotation ); @@ -142,7 +142,7 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition ) if( !m_mirrorB ) NEGATE( xyPos.y ); - int rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10; + double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10; if( rotation ) RotatePoint( &xyPos, rotation ); diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp index 5dbb5a7e8a..49da2a041e 100644 --- a/gerbview/dcode.cpp +++ b/gerbview/dcode.cpp @@ -502,7 +502,7 @@ void D_CODE::ConvertShapeToPolygon() for( unsigned ii = 0; ii <= SEGS_CNT; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600 / SEGS_CNT ); + RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT ); m_PolyCorners.push_back( currpos ); } @@ -552,7 +552,7 @@ void D_CODE::ConvertShapeToPolygon() for( ; ii <= SEGS_CNT / 2; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600 / SEGS_CNT ); + RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT ); currpos.x += delta; m_PolyCorners.push_back( currpos ); } @@ -561,7 +561,7 @@ void D_CODE::ConvertShapeToPolygon() for( ii = SEGS_CNT / 2; ii <= SEGS_CNT; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600 / SEGS_CNT ); + RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT ); currpos.x -= delta; m_PolyCorners.push_back( currpos ); } @@ -592,7 +592,7 @@ void D_CODE::ConvertShapeToPolygon() for( int ii = 0; ii <= m_EdgesCount; ii++ ) { currpos = initialpos; - RotatePoint( &currpos, ii * 3600 / m_EdgesCount ); + RotatePoint( &currpos, ii * 3600.0 / m_EdgesCount ); m_PolyCorners.push_back( currpos ); } @@ -633,7 +633,7 @@ static void addHoleToPolygon( std::vector& aBuffer, { currpos.x = 0; currpos.y = aSize.x / 2; // aSize.x / 2 is the radius of the hole - RotatePoint( &currpos, ii * 3600 / SEGS_CNT ); + RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT ); aBuffer.push_back( currpos ); } diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp index 198eb78efd..83a8a6ca97 100644 --- a/gerbview/draw_gerber_screen.cpp +++ b/gerbview/draw_gerber_screen.cpp @@ -353,7 +353,8 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode, void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, GR_DRAWMODE aDrawMode ) { wxPoint pos; - int width, orient; + int width; + double orient; wxString Line; GRSetDrawMode( aDC, aDrawMode ); diff --git a/gerbview/rs274d.cpp b/gerbview/rs274d.cpp index 12c60217cb..f36e634829 100644 --- a/gerbview/rs274d.cpp +++ b/gerbview/rs274d.cpp @@ -339,8 +339,8 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, * angle is trigonometrical (counter-clockwise), * and axis is the X,Y gerber coordinates */ - int start_angle = ArcTangente( start.y, start.x ); - int end_angle = ArcTangente( end.y, end.x ); + double start_angle = ArcTangente( start.y, start.x ); + double end_angle = ArcTangente( end.y, end.x ); // dummyTrack has right geometric parameters, but // fillArcGBRITEM calculates arc parameters for a draw function that expects @@ -350,7 +350,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, if( start_angle > end_angle ) end_angle += 3600; - int arc_angle = start_angle - end_angle; + double arc_angle = start_angle - end_angle; // Approximate arc by 36 segments per 360 degree const int increment_angle = 3600 / 36; int count = std::abs( arc_angle / increment_angle ); @@ -361,7 +361,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem, wxPoint start_arc = start; for( int ii = 0; ii <= count; ii++ ) { - int rot; + double rot; wxPoint end_arc = start; if( aClockwise ) rot = ii * increment_angle; // rot is in 0.1 deg diff --git a/include/convert_basic_shapes_to_polygon.h b/include/convert_basic_shapes_to_polygon.h index 67348085b5..c7d99a8faa 100644 --- a/include/convert_basic_shapes_to_polygon.h +++ b/include/convert_basic_shapes_to_polygon.h @@ -106,7 +106,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer, * @param aWidth = width (thickness) of the line */ void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer, - wxPoint aCentre, wxPoint aStart, int aArcAngle, + wxPoint aCentre, wxPoint aStart, double aArcAngle, int aCircleToSegmentsCount, int aWidth ); /** diff --git a/include/drawtxt.h b/include/drawtxt.h index 7ef8b7198e..7df51db52b 100644 --- a/include/drawtxt.h +++ b/include/drawtxt.h @@ -94,7 +94,7 @@ void DrawGraphicText( EDA_DRAW_PANEL * aPanel, const wxPoint &aPos, enum EDA_COLOR_T aColor, const wxString &aText, - int aOrient, + double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -118,7 +118,7 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, enum EDA_COLOR_T aColor1, enum EDA_COLOR_T aColor2, const wxString &aText, - int aOrient, + double aOrient, const wxSize &aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/include/gr_basic.h b/include/gr_basic.h index 207c63447d..18cf7692da 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -203,10 +203,10 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, EDA_COLOR_T aColor ); void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, EDA_COLOR_T aColor ); -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle, - int EndAngle, int r, EDA_COLOR_T Color ); -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle, - int EndAngle, int r, int width, EDA_COLOR_T Color ); +void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, + double EndAngle, int r, EDA_COLOR_T Color ); +void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, + double EndAngle, int r, int width, EDA_COLOR_T Color ); void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc, EDA_COLOR_T Color ); void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, @@ -214,9 +214,9 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd, wxPoint aCenter, int aWidth, EDA_COLOR_T aColor ); void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, - int StAngle, int EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor ); -void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle, - int EndAngle, int r, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor ); + double StAngle, double EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor ); +void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, + double EndAngle, int r, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor ); void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color ); void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, diff --git a/include/plot_common.h b/include/plot_common.h index dfe2588349..8e11fb1dce 100644 --- a/include/plot_common.h +++ b/include/plot_common.h @@ -153,8 +153,8 @@ public: int width = DEFAULT_LINE_WIDTH ) = 0; virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, int width = DEFAULT_LINE_WIDTH ) = 0; - virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, int rayon, - FILL_T fill, int width = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); /** * moveto/lineto primitive, moves the 'pen' to the specified direction @@ -214,8 +214,8 @@ public: // Higher level primitives -- can be drawn as line, sketch or 'filled' virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ); - virtual void ThickArc( const wxPoint& centre, int StAngle, int EndAngle, int rayon, - int width, EDA_DRAW_MODE_T tracemode ); + virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, int width, EDA_DRAW_MODE_T tracemode ); virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width, EDA_DRAW_MODE_T tracemode ); virtual void ThickCircle( const wxPoint& pos, int diametre, int width, @@ -224,10 +224,10 @@ public: // Flash primitives virtual void FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode ) = 0; - virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient, + virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient, EDA_DRAW_MODE_T trace_mode ) = 0; virtual void FlashPadRect( const wxPoint& pos, const wxSize& size, - int orient, EDA_DRAW_MODE_T trace_mode ) = 0; + double orient, EDA_DRAW_MODE_T trace_mode ) = 0; /** virtual function FlashPadTrapez * flash a trapezoidal pad @@ -238,7 +238,7 @@ public: * @param aTrace_Mode = FILLED or SKETCH */ virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) = 0; + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) = 0; /** @@ -247,7 +247,7 @@ public: virtual void Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -297,7 +297,7 @@ protected: // Helper function for sketched filler segment void segmentAsOval( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ); - void sketchOval( const wxPoint& pos, const wxSize& size, int orient, + void sketchOval( const wxPoint& pos, const wxSize& size, double orient, int width ); // Coordinate and scaling conversion functions @@ -402,17 +402,17 @@ public: virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ); - virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, int rayon, - FILL_T fill, int width = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); virtual void PenTo( const wxPoint& pos, char plume ); virtual void FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode ); - virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient, + virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadRect( const wxPoint& pos, const wxSize& size, - int orient, EDA_DRAW_MODE_T trace_mode ); + double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); protected: void penControl( char plume ); @@ -459,12 +459,12 @@ public: // Pad routines are handled with lower level primitives virtual void FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode ); - virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient, + virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadRect( const wxPoint& pos, const wxSize& size, - int orient, EDA_DRAW_MODE_T trace_mode ); + double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); /** The SetColor implementation is split with the subclasses: * The PSLIKE computes the rgb values, the subclass emits the @@ -543,8 +543,8 @@ public: int width = DEFAULT_LINE_WIDTH ); virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); - virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, - int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); @@ -556,7 +556,7 @@ public: virtual void Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -610,8 +610,8 @@ public: int width = DEFAULT_LINE_WIDTH ); virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); - virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, - int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH); @@ -621,7 +621,7 @@ public: virtual void Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -677,8 +677,8 @@ public: int width = DEFAULT_LINE_WIDTH ); virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); - virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, - int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); @@ -690,7 +690,7 @@ public: virtual void Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, @@ -786,21 +786,21 @@ public: int width = DEFAULT_LINE_WIDTH ); virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); - virtual void Arc( const wxPoint& aCenter, int aStAngle, int aEndAngle, int aRadius, - FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle, + int aRadius, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); virtual void PlotPoly( const std::vector< wxPoint >& aCornerList, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); virtual void PenTo( const wxPoint& pos, char plume ); virtual void FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode ); - virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient, + virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadRect( const wxPoint& pos, const wxSize& size, - int orient, EDA_DRAW_MODE_T trace_mode ); + double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); virtual void SetLayerPolarity( bool aPositive ); @@ -877,22 +877,22 @@ public: FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH ); virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width, EDA_DRAW_MODE_T tracemode ); - virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, int rayon, - FILL_T fill, int width = DEFAULT_LINE_WIDTH ); + virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle, + int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH ); virtual void PenTo( const wxPoint& pos, char plume ); virtual void FlashPadCircle( const wxPoint& pos, int diametre, EDA_DRAW_MODE_T trace_mode ); - virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient, + virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadRect( const wxPoint& pos, const wxSize& size, - int orient, EDA_DRAW_MODE_T trace_mode ); + double orient, EDA_DRAW_MODE_T trace_mode ); virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners, - int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); + double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ); virtual void Text( const wxPoint& aPos, enum EDA_COLOR_T aColor, const wxString& aText, - int aOrient, + double aOrient, const wxSize& aSize, enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify, diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 964b4163d4..970c1ed6ff 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -291,7 +291,7 @@ public: MODULE* Create_1_Module( const wxString& aModuleName ); void Edit_Module( MODULE* module, wxDC* DC ); - void Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental ); + void Rotate_Module( wxDC* DC, MODULE* module, double angle, bool incremental ); /** * Function PlaceModule diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 8a87869d7b..c5b586235d 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -1482,7 +1482,7 @@ public: * @param include_fixe = true to orient locked footprints * @return true if some footprints modified, false if no change */ - bool ReOrientModules( const wxString& ModuleMask, int Orient, bool include_fixe ); + bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe ); void LockModule( MODULE* aModule, bool aLocked ); void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb ); diff --git a/pcbnew/autorouter/autorout.h b/pcbnew/autorouter/autorout.h index 7a5ba1b0ab..98f5ac0b3a 100644 --- a/pcbnew/autorouter/autorout.h +++ b/pcbnew/autorouter/autorout.h @@ -209,7 +209,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, /* Same as above, but the rectangle is inclined angle angle. */ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, - int angle, LAYER_MSK masque_layer, + double angle, LAYER_MSK masque_layer, int color, int op_logic ); /* QUEUE.CPP */ diff --git a/pcbnew/autorouter/graphpcb.cpp b/pcbnew/autorouter/graphpcb.cpp index 69d4408cd0..294e20e969 100644 --- a/pcbnew/autorouter/graphpcb.cpp +++ b/pcbnew/autorouter/graphpcb.cpp @@ -47,7 +47,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color ); void TraceArc( int ux0, int uy0, int ux1, int uy1, - int ArcAngle, + double ArcAngle, int lg, LAYER_NUM layer, int color, int op_logic ); @@ -531,7 +531,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1, - int angle, LAYER_MSK aLayerMask, int color, int op_logic ) + double angle, LAYER_MSK aLayerMask, int color, int op_logic ) { int row, col; int cx, cy; // Center of rectangle @@ -630,7 +630,6 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer int row_max, col_max, row_min, col_min; int demi_pas; - int angle; int cx, cy, dx, dy; RoutingMatrix.SetCellOperation( op_logic ); @@ -686,6 +685,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer dx = ux1 - ux0; dy = uy1 - uy0; + double angle; if( dx ) { angle = ArcTangente( dy, dx ); @@ -792,14 +792,14 @@ void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer, * center = ux0,uy0, starting at ux1, uy1. Coordinates are in * PCB units. */ -void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg, +void TraceArc( int ux0, int uy0, int ux1, int uy1, double ArcAngle, int lg, LAYER_NUM layer, int color, int op_logic ) { int radius, nb_segm; int x0, y0, // Starting point of the current segment trace x1, y1; // End point int ii; - int angle, StAngle; + double angle, StAngle; radius = KiROUND( Distance( ux0, uy0, ux1, uy1 ) ); diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp index cbbeaace6f..f35b61916a 100644 --- a/pcbnew/board_items_to_polygon_shape_transform.cpp +++ b/pcbnew/board_items_to_polygon_shape_transform.cpp @@ -417,11 +417,11 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer double aCorrectionFactor ) const { wxPoint corner_position; - int angle; + double angle; int dx = (m_Size.x / 2) + aClearanceValue; int dy = (m_Size.y / 2) + aClearanceValue; - int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree + double delta = 3600.0 / aCircleToSegmentsCount; // rot angle in 0.1 degree wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset, * the pad position is NOT the shape position */ wxSize psize = m_Size; /* pad size unsed in RECT and TRAPEZOIDAL pads @@ -480,7 +480,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ ) { corner_position = wxPoint( 0, -rounding_radius ); - RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) ); + RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) ); // Start at half increment offset angle_pg = i * delta; @@ -499,7 +499,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ ) { corner_position = wxPoint( -rounding_radius, 0 ); - RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) ); + RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) ); angle_pg = i * delta; RotatePoint( &corner_position, angle_pg ); corner_position -= wxPoint( psize.x / 2, -psize.y / 2 ); @@ -512,7 +512,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ ) { corner_position = wxPoint( 0, rounding_radius ); - RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) ); + RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) ); angle_pg = i * delta; RotatePoint( &corner_position, angle_pg ); corner_position += psize / 2; @@ -525,7 +525,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ ) { corner_position = wxPoint( rounding_radius, 0 ); - RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) ); + RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) ); angle_pg = i * delta; RotatePoint( &corner_position, angle_pg ); corner_position -= wxPoint( -psize.x / 2, psize.y / 2 ); @@ -665,7 +665,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer, int aMinThicknessValue, int aCircleToSegmentsCount, double aCorrectionFactor, - int aThermalRot ) + double aThermalRot ) { wxPoint corner, corner_end; wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset, @@ -675,7 +675,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer, int dx = aPad.GetSize().x / 2; int dy = aPad.GetSize().y / 2; - int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree + double delta = 3600.0 / aCircleToSegmentsCount; // rot angle in 0.1 degree /* Keep in account the polygon outline thickness * aThermalGap must be increased by aMinThicknessValue/2 because drawing external outline @@ -759,8 +759,8 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer, // Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg // aThermalRot = 450 (45.0 degrees orientation) work fine. - int angle_pad = aPad.GetOrientation(); // Pad orientation - int th_angle = aThermalRot; + double angle_pad = aPad.GetOrientation(); // Pad orientation + double th_angle = aThermalRot; for( unsigned ihole = 0; ihole < 4; ihole++ ) { @@ -864,7 +864,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer, /* Create 2 holes, rotated by pad rotation. */ - int angle = aPad.GetOrientation() + supp_angle; + double angle = aPad.GetOrientation() + supp_angle; for( int irect = 0; irect < 2; irect++ ) { @@ -946,16 +946,16 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer, corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) ); corners_buffer.push_back( wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) ); - int angle = aPad.GetOrientation(); + double angle = aPad.GetOrientation(); int rounding_radius = KiROUND( aThermalGap * aCorrectionFactor ); // Corner rounding radius - int angle_pg; // Polygon increment angle + double angle_pg; // Polygon increment angle for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ ) { wxPoint corner_position = wxPoint( 0, -rounding_radius ); // Start at half increment offset - RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount ); + RotatePoint( &corner_position, 1800.0 / aCircleToSegmentsCount ); angle_pg = i * delta; RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp index f705d48d04..3fecfdc499 100644 --- a/pcbnew/class_drawsegment.cpp +++ b/pcbnew/class_drawsegment.cpp @@ -232,7 +232,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, break; case S_ARC: - int StAngle, EndAngle; + double StAngle, EndAngle; radius = KiROUND( Distance( ux0, uy0, dx, dy ) ); StAngle = ArcTangente( dy - uy0, dx - ux0 ); EndAngle = StAngle + m_Angle; diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 8fc8cd519a..de091ac9e9 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -550,7 +550,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), Line, RED ) ); } - int module_orient = module ? module->GetOrientation() : 0; + double module_orient = module ? module->GetOrientation() : 0; if( module_orient ) Line.Printf( wxT( "%3.1f(+%3.1f)" ), diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h index 4c824e288b..df09eeac61 100644 --- a/pcbnew/class_pad.h +++ b/pcbnew/class_pad.h @@ -296,7 +296,7 @@ public: * inflate, < 0 deflate * @param aRotation = full rotation of the polygon */ - void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const; + void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, double aRotation ) const; /** * Function BuildPadShapePolygon @@ -347,7 +347,7 @@ public: * @param aRotation = full rotation of the segment * @return the width of the segment */ - int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const; + int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, double aRotation ) const; void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp index cf32dbe6bb..1619e599be 100644 --- a/pcbnew/class_pad_draw_functions.cpp +++ b/pcbnew/class_pad_draw_functions.cpp @@ -311,7 +311,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) { wxPoint coord[4]; int delta_cx, delta_cy; - int angle = m_Orient; + double angle = m_Orient; int seg_width; GRSetDrawMode( aDC, aDrawInfo.m_DrawMode ); @@ -528,7 +528,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) RotatePoint( &tpos, shape_pos, angle ); // Draw text with an angle between -90 deg and + 90 deg - int t_angle = angle; + double t_angle = angle; NORMALIZE_ANGLE_90( t_angle ); /* Note: in next calculations, texte size is calculated for 3 or more @@ -596,7 +596,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo ) * aRotation is the asked rotation of the segment (usually m_Orient) */ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, - int aRotation) const + double aRotation) const { int width; @@ -630,7 +630,7 @@ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd, void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, - int aRotation ) const + double aRotation ) const { wxSize delta; wxSize halfsize; diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp index 0b7ce34ccf..0ed645b46c 100644 --- a/pcbnew/class_text_mod.cpp +++ b/pcbnew/class_text_mod.cpp @@ -144,7 +144,7 @@ void TEXTE_MODULE::SetLocalCoord() m_Pos0 = m_Pos - module->GetPosition(); - int angle = module->GetOrientation(); + double angle = module->GetOrientation(); RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle ); } @@ -206,7 +206,7 @@ EDA_RECT TEXTE_MODULE::GetBoundingBox() const { // Calculate area without text fields: EDA_RECT text_area; - int angle = GetDrawRotation(); + double angle = GetDrawRotation(); wxPoint textstart, textend; text_area = GetTextRect(); @@ -294,7 +294,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode, // Draw the text proper, with the right attributes wxSize size = m_Size; - int orient = GetDrawRotation(); + double orient = GetDrawRotation(); // If the text is mirrored : negate size.x (mirror / Y axis) if( m_Mirror ) @@ -324,12 +324,10 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel, /* Return text rotation for drawings and plotting */ -int TEXTE_MODULE::GetDrawRotation() const +double TEXTE_MODULE::GetDrawRotation() const { - int rotation; MODULE* module = (MODULE*) m_Parent; - - rotation = m_Orient; + double rotation = m_Orient; if( module ) rotation += module->GetOrientation(); diff --git a/pcbnew/class_text_mod.h b/pcbnew/class_text_mod.h index 1e7e94a199..cf00b9df13 100644 --- a/pcbnew/class_text_mod.h +++ b/pcbnew/class_text_mod.h @@ -98,7 +98,7 @@ public: int GetLength() const; // text length - int GetDrawRotation() const; // Return text rotation for drawings and plotting + double GetDrawRotation() const; // Return text rotation for drawings and plotting /** * Function GetTextRect diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp index b4a72f2ab6..d5adff4306 100644 --- a/pcbnew/class_track.cpp +++ b/pcbnew/class_track.cpp @@ -711,7 +711,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, // Calculate angle: if the track segment is vertical, angle = 90 degrees // If horizontal 0 degrees, otherwise compute it - int angle; // angle is in 0.1 degree + double angle; // angle is in 0.1 degree if( dy == 0 ) // Horizontal segment { diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index d26e0f4327..18917824ac 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -165,7 +165,7 @@ void DialogEditModuleText::initDlg( ) AddUnitSymbol( *m_WidthTitle ); PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() ); - int text_orient = m_currentText->GetOrientation(); + double text_orient = m_currentText->GetOrientation(); NORMALIZE_ANGLE_90( text_orient ); if( (text_orient != 0) ) diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 6a6beef2b0..352736df26 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -126,7 +126,10 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( ) m_StartPointYLabel->SetLabel(_("Center Y")); m_EndPointXLabel->SetLabel(_("Start Point X")); m_EndPointYLabel->SetLabel(_("Start Point Y")); - msg << m_Item->GetAngle(); + + // Here the angle is a double, but the UI is still working + // with integers + msg << int( m_Item->GetAngle() ); m_Angle_Ctrl->SetValue(msg); break; diff --git a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp index 9af075cc13..3618570380 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties_for_Modedit.cpp @@ -128,7 +128,10 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg() m_StartPointYLabel->SetLabel(_("Center Y")); m_EndPointXLabel->SetLabel(_("Start Point X")); m_EndPointYLabel->SetLabel(_("Start Point Y")); - msg << m_item->GetAngle(); + + // Here the angle is a double, but the UI is still working + // with integers + msg << int( m_item->GetAngle() ); m_Angle_Ctrl->SetValue(msg); break; diff --git a/pcbnew/dialogs/dialog_orient_footprints.cpp b/pcbnew/dialogs/dialog_orient_footprints.cpp index f6e7b45ddc..4c6dd832d5 100644 --- a/pcbnew/dialogs/dialog_orient_footprints.cpp +++ b/pcbnew/dialogs/dialog_orient_footprints.cpp @@ -110,7 +110,7 @@ void PCB_EDIT_FRAME::OnOrientFootprints( wxCommandEvent& event ) } -bool PCB_EDIT_FRAME::ReOrientModules( const wxString& ModuleMask, int Orient, +bool PCB_EDIT_FRAME::ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe ) { wxString line; diff --git a/pcbnew/drc_clearance_test_functions.cpp b/pcbnew/drc_clearance_test_functions.cpp index 6c813a1bc8..b0d1d01a56 100644 --- a/pcbnew/drc_clearance_test_functions.cpp +++ b/pcbnew/drc_clearance_test_functions.cpp @@ -354,8 +354,6 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) // If the reference segment is a via, we test it here if( aRefSeg->Type() == PCB_VIA_T ) { - int angle = 0; // angle du segment a tester; - delta = track->GetEnd() - track->GetStart(); segStartPoint = aRefSeg->GetStart() - track->GetStart(); @@ -371,8 +369,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) } else // test via to segment { - // Compute l'angle - angle = ArcTangente( delta.y, delta.x ); + // Compute l'angle du segment a tester; + double angle = ArcTangente( delta.y, delta.x ); // Compute new coordinates ( the segment become horizontal) RotatePoint( &delta, angle ); @@ -528,7 +526,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads ) delta = segEndPoint - segStartPoint; // Compute the segment orientation (angle) en 0,1 degre - int angle = ArcTangente( delta.y, delta.x ); + double angle = ArcTangente( delta.y, delta.x ); // Compute the segment lenght: delta.x = lenght after rotation RotatePoint( &delta, angle ); @@ -572,7 +570,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) { int dist; - int pad_angle; + double pad_angle; // Get the clerance between the 2 pads. this is the min distance between aRefPad and aPad int dist_min = aRefPad->GetClearance( aPad ); @@ -804,7 +802,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad ) bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMinDist ) { wxSize padHalfsize; // half the dimension of the pad - int orient; wxPoint startPoint, endPoint; int seuil; int deltay; @@ -843,7 +840,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi startPoint.x = startPoint.y = 0; endPoint = m_segmEnd; - orient = aPad->GetOrientation(); + double orient = aPad->GetOrientation(); RotatePoint( &startPoint, m_padToTestPos, -orient ); RotatePoint( &endPoint, m_padToTestPos, -orient ); diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h index f73f15c8aa..e031cdc20a 100644 --- a/pcbnew/drc_stuff.h +++ b/pcbnew/drc_stuff.h @@ -179,7 +179,7 @@ private: * so we store the ref segment length (the end point relative to these axis) * and the segment orientation (used to rotate other coordinates) */ - int m_segmAngle; // Ref segm orientation in 0,1 degre + double m_segmAngle; // Ref segm orientation in 0,1 degre int m_segmLength; // length of the reference segment /* variables used in checkLine to test DRC segm to segm: diff --git a/pcbnew/edtxtmod.cpp b/pcbnew/edtxtmod.cpp index 4b78b6d24a..01869ae06f 100644 --- a/pcbnew/edtxtmod.cpp +++ b/pcbnew/edtxtmod.cpp @@ -54,7 +54,7 @@ wxPoint MoveVector; // Move vector for move edge, exported // to dialog_edit mod_text.cpp static wxPoint TextInitialPosition; // Mouse cursor initial position for // undo/abort move command -static int TextInitialOrientation; // module text initial orientation for +static double TextInitialOrientation; // module text initial orientation for // undo/abort move+rot command+rot @@ -233,7 +233,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) if( Module ) { // Prepare undo command (a rotation can be made while moving) - int tmp = Text->GetOrientation(); + double tmp = Text->GetOrientation(); Text->SetOrientation( TextInitialOrientation ); if( IsType( PCB_FRAME_TYPE ) ) diff --git a/pcbnew/export_gencad.cpp b/pcbnew/export_gencad.cpp index 31a9142f49..fbe33bcab0 100644 --- a/pcbnew/export_gencad.cpp +++ b/pcbnew/export_gencad.cpp @@ -498,7 +498,6 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) MODULE* module; D_PAD* pad; const char* layer; - int orient; wxString pinname; const char* mirror = "0"; @@ -531,7 +530,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb ) if( pinname.IsEmpty() ) pinname = wxT( "none" ); - orient = pad->GetOrientation() - module->GetOrientation(); + double orient = pad->GetOrientation() - module->GetOrientation(); NORMALIZE_ANGLE_POS( orient ); // Bottom side modules use the flipped padstack @@ -563,7 +562,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) TEXTE_MODULE* textmod; const char* mirror; const char* flip; - int orient = module->GetOrientation(); + double orient = module->GetOrientation(); if( module->GetFlag() ) { @@ -598,7 +597,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb ) for( int ii = 0; ii < 2; ii++ ) { - int orient = textmod->GetOrientation(); + double orient = textmod->GetOrientation(); wxString layer = GenCADLayerName[(module->GetFlag()) ? SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT]; diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 0874e8c2d7..580fe40a0c 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -421,7 +421,7 @@ static void export_vrml_circle( LAYER_NUM layer, double startx, double starty, / static void export_vrml_slot( TRIANGLEBAG& triangles, //{{{ LAYER_NUM top_layer, LAYER_NUM bottom_layer, double xc, double yc, - double dx, double dy, int orient ) + double dx, double dy, double orient ) { double capx, capy; // Cap center VLoop loop; @@ -429,7 +429,7 @@ static void export_vrml_slot( TRIANGLEBAG& triangles, //{{{ loop.z_top = layer_z[top_layer]; loop.z_bottom = layer_z[bottom_layer]; - double angle = orient / 1800.0 * M_PI; + double angle = DECIDEG2RAD( orient ); if( dy > dx ) { @@ -480,7 +480,7 @@ static void export_vrml_hole( TRIANGLEBAG& triangles, static void export_vrml_oval_pad( LAYER_NUM layer, double xc, double yc, - double dx, double dy, int orient ) + double dx, double dy, double orient ) { double capx, capy; // Cap center FLAT_FAN fan; diff --git a/pcbnew/gendrill_Excellon_writer.h b/pcbnew/gendrill_Excellon_writer.h index 4ca739c453..2a059fade4 100644 --- a/pcbnew/gendrill_Excellon_writer.h +++ b/pcbnew/gendrill_Excellon_writer.h @@ -67,7 +67,7 @@ public: int m_Hole_Diameter; // hole value, and for oblong: min(hole size x, hole size y) int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0 must not be used) wxSize m_Hole_Size; // hole size for oblong holes - int m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes + double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes int m_Hole_Shape; // hole shape: round (0) or oval (1) wxPoint m_Hole_Pos; // hole position LAYER_NUM m_Hole_Bottom_Layer; // hole starting layer (usually back layer) diff --git a/pcbnew/globaleditpad.cpp b/pcbnew/globaleditpad.cpp index ac4ada17e4..a3c9796363 100644 --- a/pcbnew/globaleditpad.cpp +++ b/pcbnew/globaleditpad.cpp @@ -252,7 +252,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad, if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) ) continue; - int currpad_orient = pad->GetOrientation() - module->GetOrientation(); + double currpad_orient = pad->GetOrientation() - module->GetOrientation(); if( aPadOrientFilter && ( currpad_orient != pad_orient ) ) continue; diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 7d5c46da58..7d96639fe4 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -432,7 +432,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat * If DC == NULL, the component does not redraw. * Otherwise, it erases and redraws turns */ -void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental ) +void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool incremental ) { if( module == NULL ) return; diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp index a1d21a6602..f69f81534d 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp @@ -93,8 +93,8 @@ void PCB_ARC::Parse( XNODE* aNode, SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit, &endX, &endY, aActualConversion ); - int alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX ); - int alpha2 = ArcTangente( endY - m_positionY, endX - m_positionX ); + double alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX ); + double alpha2 = ArcTangente( endY - m_positionY, endX - m_positionX ); m_angle = alpha1 - alpha2; NORMALIZE_ANGLE_POS( m_angle ); diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h index fc6282b099..8b1c83eb67 100644 --- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h +++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h @@ -41,7 +41,7 @@ class PCB_ARC : public PCB_COMPONENT public: int m_startX; int m_startY; - int m_angle; + double m_angle; int m_width; PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ); diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index a2634c1af8..b087af1a97 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -209,7 +209,8 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColo { wxSize size; wxPoint pos; - int orient, thickness; + double orient; + int thickness; if( aColor == WHITE ) aColor = LIGHTGRAY; @@ -447,7 +448,8 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge ) // Plot a PCB Text, i;e. a text found on a copper or technical layer void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte ) { - int orient, thickness; + double orient; + int thickness; wxPoint pos; wxSize size; @@ -586,7 +588,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone ) void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg ) { int thickness; - int radius = 0, StAngle = 0, EndAngle = 0; + int radius = 0; + double StAngle = 0, EndAngle = 0; if( (GetLayerMask( aSeg->GetLayer() ) & m_layerMask) == 0 ) return; diff --git a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp index afe7b12ab2..b5acf10555 100644 --- a/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp +++ b/pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp @@ -67,7 +67,7 @@ extern void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer, BOARD* aPcb, ZONE_CONTAINER* aZone, double aArcCorrection, - int aRoundPadThermalRotation); + double aRoundPadThermalRotation); extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb, ZONE_CONTAINER* aZone_container ); @@ -79,10 +79,10 @@ extern void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer, int aMinThicknessValue, int aCircleToSegmentsCount, double aCorrectionFactor, - int aThermalRot ); + double aThermalRot ); // Local Variables: -static int s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads +static double s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads // how many segments are used to create a polygon from a circle: static int s_CircleToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* default value. the real value will be changed to diff --git a/pcbnew/zones_convert_to_polygons_aux_functions.cpp b/pcbnew/zones_convert_to_polygons_aux_functions.cpp index 15f351dac4..e46a7ff152 100644 --- a/pcbnew/zones_convert_to_polygons_aux_functions.cpp +++ b/pcbnew/zones_convert_to_polygons_aux_functions.cpp @@ -130,7 +130,7 @@ void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer, BOARD* aPcb, ZONE_CONTAINER* aZone, double aArcCorrection, - int aRoundPadThermalRotation ) + double aRoundPadThermalRotation ) { std::vector corners_buffer; // a local polygon buffer to store one stub corners_buffer.reserve( 4 ); @@ -213,7 +213,7 @@ void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer, // This is a CIRCLE pad tweak // for circle pads, the thermal stubs orientation is 45 deg - int fAngle = pad->GetOrientation(); + double fAngle = pad->GetOrientation(); if( pad->GetShape() == PAD_CIRCLE ) { endpoint.x = KiROUND( endpoint.x * aArcCorrection );