PCB_SHAPE::HitTest for intersection selection for footprint polygon uses footpint coordinates instead of board coordinates
Description
See #8571 (comment 596077437) and forward. When the the selection box which has been drawn from right to left and a footprint polygon are tested if they intersect, the polygon's footprint coordinates aren't translated to board coordinates. Therefore the test usually fails. Other selection methods don't use the polygon in the same way and they succeed.
Proposed solution: instead of using the polygon directly in the test, copy it first, rotate and move it so that it has the board coordinates and then test against it.
I will test the solution for 5.99 and if it works and doesn't have side effects, I will make a merge request.
5.1 has a bit different architecture (no pcbnew/pcb_shape) so it has to be fixed separately.
Steps to reproduce
See the issue linked to above.
KiCad Version
Application: KiCad PCB Editor
Version: (5.99.0-10962-g7d794f7c1c-dirty), debug build
Libraries:
wxWidgets 3.0.5
libcurl/7.74.0 OpenSSL/1.1.1j zlib/1.2.11 brotli/1.0.9 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) libssh/0.9.5/openssl/zlib nghttp2/1.43.0 librtmp/2.3
Platform: Linux 5.11.0-18-generic x86_64, 64 bit, Little endian, wxGTK, KDE, x11
Build Info:
Date: Jun 13 2021 14:49:48
wxWidgets: 3.0.5 (wchar_t,wx containers,compatible with 2.8) GTK+ 3.24
Boost: 1.74.0
OCC: 7.5.1
Curl: 7.74.0
ngspice: 34
Compiler: Clang 12.0.0 with C++ ABI 1002
Build settings:
KICAD_USE_OCC=ON
KICAD_SPICE=ON
KICAD_STDLIB_DEBUG=OFF
KICAD_STDLIB_LIGHT_DEBUG=OFF
KICAD_SANITIZE_ADDRESS=OFF
KICAD_SANITIZE_THREADS=OFF