From 3a03c7925574a16c0ff1af525177df7e4c5c6091 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 7 Aug 2018 12:13:23 +0100 Subject: [PATCH] Double opening speed of PCBs with ground and/or power planes. (Or any other boards with complicated zones.) (cherry picked from commit 7c04d8be1cd4d78227d67fea0dff3de5980eaa00) --- common/geometry/shape_poly_set.cpp | 10 +++++----- include/geometry/shape_line_chain.h | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp index 6bc8f5c549..9cba55d50c 100644 --- a/common/geometry/shape_poly_set.cpp +++ b/common/geometry/shape_poly_set.cpp @@ -2134,20 +2134,20 @@ bool SHAPE_POLY_SET::HasTouchingHoles() const bool SHAPE_POLY_SET::hasTouchingHoles( const POLYGON& aPoly ) const { - std::vector< VECTOR2I > pts; + std::set< long long > ptHashes; for( const auto& lc : aPoly ) { - for( int i = 0; i < lc.PointCount(); i++ ) + for( const VECTOR2I& pt : lc.CPoints() ) { - const auto p = lc.CPoint( i ); + const long long ptHash = (long long) pt.x << 32 | pt.y; - if( std::find( pts.begin(), pts.end(), p ) != pts.end() ) + if( ptHashes.count( ptHash ) > 0 ) { return true; } - pts.push_back( p ); + ptHashes.insert( ptHash ); } } diff --git a/include/geometry/shape_line_chain.h b/include/geometry/shape_line_chain.h index 094488c9c8..04e7e2708b 100644 --- a/include/geometry/shape_line_chain.h +++ b/include/geometry/shape_line_chain.h @@ -260,6 +260,11 @@ public: return m_points[aIndex]; } + const std::vector& CPoints() const + { + return m_points; + } + /** * Returns the last point in the line chain. */