diff --git a/libs/kimath/CMakeLists.txt b/libs/kimath/CMakeLists.txt index 832bfa888b..e61158f210 100644 --- a/libs/kimath/CMakeLists.txt +++ b/libs/kimath/CMakeLists.txt @@ -7,7 +7,6 @@ set( KIMATH_SRCS src/geometry/convex_hull.cpp src/geometry/direction_45.cpp src/geometry/geometry_utils.cpp - src/geometry/polygon_test_point_inside.cpp src/geometry/seg.cpp src/geometry/shape.cpp src/geometry/shape_arc.cpp diff --git a/libs/kimath/include/geometry/polygon_test_point_inside.h b/libs/kimath/include/geometry/polygon_test_point_inside.h deleted file mode 100644 index f2f59bea91..0000000000 --- a/libs/kimath/include/geometry/polygon_test_point_inside.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2007-2014 KiCad Developers, see CHANGELOG.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 Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifdef WX_COMPATIBILITY -#include // for wxPoint definition -#else -// define here wxPoint if we want to compile outside wxWidgets -class wxPoint -{ -public: - int x, y; -}; -#endif - - -/** - * Function TestPointInsidePolygon (overlaid) - * same as previous, but mainly use wxPoint - * @param aPolysList: the list of polygons - * @param aCount: corners count in aPolysList. - * @param aRefPoint: the point coordinate to test - * @return true if the point is inside, false for outside - */ -bool TestPointInsidePolygon( const wxPoint* aPolysList, - int aCount, - const wxPoint &aRefPoint ); diff --git a/libs/kimath/src/geometry/polygon_test_point_inside.cpp b/libs/kimath/src/geometry/polygon_test_point_inside.cpp deleted file mode 100644 index 9de3824954..0000000000 --- a/libs/kimath/src/geometry/polygon_test_point_inside.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2007-2014 KiCad Developers, see CHANGELOG.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 Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file polygon_test_point_inside.cpp - */ - -#include - -/* this algo uses the the Jordan curve theorem to find if a point is inside or outside a polygon: - * It run a semi-infinite line horizontally (increasing x, fixed y) - * out from the test point, and count how many edges it crosses. - * At each crossing, the ray switches between inside and outside. - * If odd count, the test point is inside the polygon - * This is called the Jordan curve theorem, or sometimes referred to as the "even-odd" test. - * Take care to starting and ending points of segments outlines, when the horizontal line crosses a segment outline - * exactly on an ending point: - * Because the starting point of a segment is also the ending point of the previous, only one must be used. - * And we do no use twice the same segment, so we do NOT use both starting and ending points of these 2 segments. - * So we must use only one ending point of each segment when calculating intersections - * but it cannot be always the starting or the ending point. This depends on relative position of 2 consectutive segments - * Here, the ending point above the Y reference position is used - * and the ending point below or equal the Y reference position is NOT used - * Obviously, others cases are irrelevant because there is not intersection. - */ - -#define OUTSIDE false -#define INSIDE true - - -/* Function TestPointInsidePolygon (overlaid) - * same as previous, but use wxPoint and aCount corners - */ -bool TestPointInsidePolygon( const wxPoint *aPolysList, int aCount, const wxPoint &aRefPoint ) -{ - // count intersection points to right of (refx,refy). If odd number, point (refx,refy) is inside polyline - int ics, ice; - int count = 0; - // find all intersection points of line with polyline sides - for( ics = 0, ice = aCount-1; ics < aCount; ice = ics++ ) - { - int seg_startX = aPolysList[ics].x; - int seg_startY = aPolysList[ics].y; - int seg_endX = aPolysList[ice].x; - int seg_endY = aPolysList[ice].y; - - /* Trivial cases: skip if ref above or below the segment to test */ - if( ( seg_startY > aRefPoint.y ) && (seg_endY > aRefPoint.y ) ) - continue; - - // segment below ref point, or one of its ends has the same Y pos as the ref point: skip - // So we eliminate one end point of 2 consecutive segments. - // Note: also we skip horizontal segments if ref point is on this horizontal line - // So reference points on horizontal segments outlines always are seen as outside the polygon - if( ( seg_startY <= aRefPoint.y ) && (seg_endY <= aRefPoint.y ) ) - continue; - - /* refy is between seg_startY and seg_endY. - * note: here: horizontal segments (seg_startY == seg_endY) are skipped, - * either by the first test or by the second test - * see if an horizontal semi infinite line from refx is intersecting the segment - */ - - // calculate the x position of the intersection of this segment and the semi infinite line - // this is more easier if we move the X,Y axis origin to the segment start point: - seg_endX -= seg_startX; - seg_endY -= seg_startY; - double newrefx = (double) (aRefPoint.x - seg_startX); - double newrefy = (double) (aRefPoint.y - seg_startY); - - // Now calculate the x intersection coordinate of the line from (0,0) to (seg_endX,seg_endY) - // with the horizontal line at the new refy position - // the line slope = seg_endY/seg_endX; - // and the x pos relative to the new origin is intersec_x = refy/slope - // Note: because horizontal segments are skipped, 1/slope exists (seg_endY never == O) - double intersec_x = (newrefy * seg_endX) / seg_endY; - if( newrefx < intersec_x ) // Intersection found with the semi-infinite line from refx to infinite - count++; - } - - return count & 1 ? INSIDE : OUTSIDE; -} diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 8267bdba35..71c79d789b 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -45,7 +45,6 @@ #include #include #include -#include #include #include diff --git a/pcbnew/drc/drc_test_provider_silk_clearance.cpp b/pcbnew/drc/drc_test_provider_silk_clearance.cpp index 7ff6eee623..862b5bd922 100644 --- a/pcbnew/drc/drc_test_provider_silk_clearance.cpp +++ b/pcbnew/drc/drc_test_provider_silk_clearance.cpp @@ -25,7 +25,6 @@ #include #include -#include #include #include diff --git a/pcbnew/drc/drc_test_provider_silk_to_mask.cpp b/pcbnew/drc/drc_test_provider_silk_to_mask.cpp index 78bcdaea33..722883ba42 100644 --- a/pcbnew/drc/drc_test_provider_silk_to_mask.cpp +++ b/pcbnew/drc/drc_test_provider_silk_to_mask.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -202,4 +201,4 @@ std::set DRC_TEST_PROVIDER_SILK_TO_MASK::GetConstraintTyp namespace detail { static DRC_REGISTER_TEST_PROVIDER dummy; -} \ No newline at end of file +} diff --git a/qa/drc_proto/drc_test_provider_silk_to_pad.cpp b/qa/drc_proto/drc_test_provider_silk_to_pad.cpp index aeddfa5e86..f83864fbe8 100644 --- a/qa/drc_proto/drc_test_provider_silk_to_pad.cpp +++ b/qa/drc_proto/drc_test_provider_silk_to_pad.cpp @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -56,15 +55,15 @@ public: { } - virtual ~DRC_TEST_PROVIDER_SILK_TO_PAD() + virtual ~DRC_TEST_PROVIDER_SILK_TO_PAD() { } virtual bool Run() override; - virtual const wxString GetName() const override + virtual const wxString GetName() const override { - return "silk_to_pad"; + return "silk_to_pad"; }; virtual const wxString GetDescription() const override @@ -127,7 +126,7 @@ bool test::DRC_TEST_PROVIDER_SILK_TO_PAD::Run() for( auto boardItem : boardItems ) { // printf("BoardT %d\n", boardItem->Type() ); - + auto shape = boardItem->GetEffectiveShape(); auto constraint = m_drcEngine->EvalRulesForItems( DRC_CONSTRAINT_TYPE_EDGE_CLEARANCE,