diff --git a/common/gr_basic.cpp b/common/gr_basic.cpp index a5a0819418..78e2eeb7d2 100644 --- a/common/gr_basic.cpp +++ b/common/gr_basic.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -621,91 +621,6 @@ void GRFilledArc1( EDA_RECT* ClipBox, wxDC* DC, const VECTOR2I& aStart, const VE } -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, double StAngle, double EndAngle, int r, - const COLOR4D& Color ) -{ - int x1, y1, x2, y2; - - /* Clip arcs off screen */ - if( ClipBox ) - { - int radius = r + 1; - int x0, y0, xm, ym, x, y; - x0 = ClipBox->GetX(); - y0 = ClipBox->GetY(); - xm = ClipBox->GetRight(); - ym = ClipBox->GetBottom(); - x = xc; - y = yc; - - if( x < ( x0 - radius ) ) - return; - - if( y < ( y0 - radius ) ) - return; - - if( x > ( xm + radius ) ) - return; - - if( y > ( ym + radius ) ) - return; - } - - x1 = r; - y1 = 0; - RotatePoint( &x1, &y1, EndAngle ); - - x2 = r; - y2 = 0; - RotatePoint( &x2, &y2, StAngle ); - - GRSetBrush( DC, Color, NOT_FILLED ); - GRSetColorPen( DC, Color ); - DC->DrawArc( xc + x1, yc - y1, xc + x2, yc - y2, xc, yc ); -} - - -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, double EndAngle, int r, - int width, const COLOR4D& Color ) -{ - int x1, y1, x2, y2; - - /* Clip arcs off screen. */ - if( ClipBox ) - { - int x0, y0, xm, ym; - x0 = ClipBox->GetX(); - y0 = ClipBox->GetY(); - xm = ClipBox->GetRight(); - ym = ClipBox->GetBottom(); - - if( x < ( x0 - r - width ) ) - return; - - if( y < ( y0 - r - width ) ) - return; - - if( x > ( r + xm + width ) ) - return; - - if( y > ( r + ym + width ) ) - return; - } - - x1 = r; - y1 = 0; - RotatePoint( &x1, &y1, EndAngle ); - - x2 = r; - y2 = 0; - RotatePoint( &x2, &y2, StAngle ); - - GRSetBrush( DC, Color ); - GRSetColorPen( DC, Color, width ); - DC->DrawArc( x + x1, y - y1, x + x2, y - y2, x, y ); -} - - void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, const COLOR4D& Color ) { diff --git a/include/gr_basic.h b/include/gr_basic.h index 827290b168..887754e666 100644 --- a/include/gr_basic.h +++ b/include/gr_basic.h @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh - * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -19,10 +19,6 @@ * with this program. If not, see . */ -/** - * @file gr_basic.h - */ - #ifndef GR_BASIC #define GR_BASIC @@ -153,10 +149,6 @@ void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aR void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aPos, int aRadius, int aWidth, const COLOR4D& aColor ); -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, - double EndAngle, int r, const COLOR4D& Color ); -void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle, - double EndAngle, int r, int width, const COLOR4D& Color ); void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int xc, int yc, int width, const COLOR4D& Color ); void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, const VECTOR2I& aStart, const VECTOR2I& aEnd, diff --git a/libs/kimath/include/trigo.h b/libs/kimath/include/trigo.h index 404288e674..9a49d54b3d 100644 --- a/libs/kimath/include/trigo.h +++ b/libs/kimath/include/trigo.h @@ -141,11 +141,6 @@ const VECTOR2D CalcArcCenter( const VECTOR2D& aStart, const VECTOR2D& aMid, cons const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aEnd, const EDA_ANGLE& aAngle ); -/** - * Return the subtended angle for a given arc. - */ -double CalcArcAngle( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ); - /** * Return the middle point of an arc, half-way between aStart and aEnd. There are two possible * solutions which can be found by toggling aMinArcAngle. The behaviour is undefined for diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index dcfd2bdceb..9f1488f7a6 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -33,12 +33,10 @@ #include #include // for alg::run_on_pair #include // for SEG, OPT_VECTOR2I -#include // for CIRCLE #include #include // for BOX2I #include // for rescale #include // for VECTOR2, VECTOR2I -#include // for RAD2DECIDEG, CalcArcAngle class SHAPE; diff --git a/libs/kimath/src/trigo.cpp b/libs/kimath/src/trigo.cpp index 9d9fb4296a..dd4a8a0c38 100644 --- a/libs/kimath/src/trigo.cpp +++ b/libs/kimath/src/trigo.cpp @@ -475,30 +475,3 @@ const VECTOR2I CalcArcCenter( const VECTOR2I& aStart, const VECTOR2I& aMid, cons } -double CalcArcAngle( const VECTOR2I& aStart, const VECTOR2I& aMid, const VECTOR2I& aEnd ) -{ - VECTOR2I center = CalcArcCenter( aStart, aMid, aEnd ); - - // Check if the new arc is CW or CCW - VECTOR2D startLine = aStart - center; - VECTOR2D endLine = aEnd - center; - double angle = RAD2DECIDEG( endLine.Angle() - startLine.Angle() ); - - VECTOR2D v1, v2; - v1 = aStart - aMid; - v2 = aEnd - aMid; - double theta = RAD2DECIDEG( v1.Angle() ); - - RotatePoint( &( v1.x ), &( v1.y ), theta ); - RotatePoint( &( v2.x ), &( v2.y ), theta ); - - bool clockwise = ( ( v1.Angle() - v2.Angle() ) > 0 ); - - // Normalize the angle - if( clockwise && angle < 0.0 ) - angle += 3600.0; - else if( !clockwise && angle > 0.0 ) - angle -= 3600.0; - - return angle; -}