1012 Commits

Author SHA1 Message Date
Jeff Young
9750f7690c Performance optimizations. 2025-06-05 18:01:44 +01:00
jean-pierre charras
2124f2b846 SHAPE_ARC::GetCentralAngle(): better algo to calculate actual arc.
The old algo worked fine only if the arc "middle point" was on the middle
of the arc. This algo just needs a "middle point" on the arc, not necessary
exactly near the middle of the arc.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/21035
2025-06-01 10:12:40 +02:00
Jeff Young
1237756b4a More performance improvements. 2025-05-25 20:53:07 +01:00
Jeff Young
ef395d3957 Slight performance improvements. 2025-05-25 20:01:18 +01:00
Seth Hillbrand
9508979040 Safety valve for integer sqrt
If the value is negative, we have likely overflowed the available size
of the integer container.  In which case, rather than slowly counting
down, we return the largest logical square root size to allow processing
to continue

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20947

(cherry picked from commit b47bf99632c8faae8855a86a0a30ef233fd594db)
2025-05-20 15:14:36 -07:00
Seth Hillbrand
9bedb6eedb Fix silk board edge collision case
First, fix the error limit check in drc_test_provider_edge_clearance.
Then, we rotate the final point incorrectly in SHAPE_ARC::Collide (need
negative angle).  We were not checking this result in the QA, so add the
proper tests
2025-05-19 17:49:03 -07:00
jean-pierre charras
7c87da41cf Fix Coverity warnings (uninitialized member), round 2 2025-05-17 16:00:30 +02:00
jean-pierre charras
a59a522438 Fix Coverity warnings (uninitialized member) 2025-05-15 17:40:39 +02:00
Jeff Young
4cd2e947a1 Slice() must also support aMaxError.
In some cases arcs are re-inserted.
2025-05-13 12:03:41 +01:00
Jeff Young
32cd142c39 Allow math tests to run with their own precision. 2025-05-12 21:57:52 +01:00
Jeff Young
3474e962d5 Use a high definition for display of arcs in SHAPE_LINE_CHAINs.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/20895
2025-05-12 20:28:47 +01:00
Jeff Young
6757ba8165 Use consistent terminology and types. 2025-05-12 20:28:47 +01:00
Michal Suchanek
81bbb5e67b Define WIN32_LEAN_AND_MEAN globally
In modern Windows code WIN32_LEAN_AND_MEAN should be defined.

Without this define windows.h pulls in some legacy headers, notably
winsocks.h. Modern code that cares about winsocks includes winsocks2.h
which conflicts with winsocks.h. Other code that does not care about
winsocks (OpenGL, fontconfig, ...) includes windows.h pulling in legacy
winsocks.h, causing definition conflicts and build errors.

At worst defining WIN32_LEAN_AND_MEAN requires explicitly including some
additional headers on Windows.
2025-05-11 15:50:10 +00:00
Michal Suchanek
ca54db2db4 windows: Fix build on case sensitive filesystem 2025-05-11 15:50:10 +00:00
Mike Williams
a582c51de7 multichannel/shapes: don't try to rectify empty polygons 2025-05-07 14:10:22 -04:00
JamesJCode
a5be581b1b Add char_traits<T> specialisations for wxUniChar and NANODBC_SQLCHAR
when building on Apple with Clang >= 17.

These specialisations are not strictly required by the C++ standard,
and have been removed from LLVM.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20631
2025-04-15 20:57:23 +01:00
Jeff Young
ac265926b1 Restore bounds checking (even though its a performance hit). 2025-04-14 15:38:18 +01:00
Jeff Young
2a2a73a1e9 Don't allow auto-conversion from double to EDA_ANGLE.
We have no idea if the double is in radians or
degrees.
2025-04-14 11:52:04 +01:00
Jeff Young
860f52800e Performance. 2025-04-05 22:18:17 +01:00
Jeff Young
7151d21f0b Performance optimisation.
Reduces board loading for #17820 from 15 seconds
to about 6.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17820
2025-04-04 13:28:27 +01:00
JamesJCode
906c24bc6d Unify length calculation between router, board / frame, and DRC 2025-03-30 09:18:41 +01:00
Seth Hillbrand
de09403b10 Fix mistake in arc circle collision
Need to test nearest point from the circle center to the arc.  Add QA to
prevent regression

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20336
2025-03-14 18:06:09 -07:00
Alex Shvartzkop
dc961d37ad Optimize SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint. 2025-03-09 16:27:07 +03:00
Alex Shvartzkop
b91e005277 Pre-fetch segments in SHAPE_LINE_CHAIN::SelfIntersecting. 2025-03-09 16:27:04 +03:00
Alex Shvartzkop
a82916f4db Improve performance of SEG::Contains. 2025-03-09 16:27:01 +03:00
Alex Shvartzkop
18d836ef8b Reduce CSegment calls in SHAPE_LINE_CHAIN::SelfIntersecting. 2025-03-09 16:26:57 +03:00
Seth Hillbrand
c24832f72b Fix IsEffectiveLine calculation
We sometimes represent circles as 360° arcs.  These are approximately
colinear but are definitely not a line
2025-03-06 12:45:10 -08:00
Kreijstal
c2685ef76f Fix compilation on mingw 2025-03-03 01:56:30 +00:00
Jeff Young
3f15b0d75b ADDED: hatched fills for shapes. 2025-02-24 11:08:29 +00:00
Jeff Young
b74c2791f4 Allow context menus in footprint chooser when called from Eeschema.
Also moves several RAII utility classes (some of which
were duplicated in open code) to a common header file.
2025-02-24 11:08:29 +00:00
Jeff Young
e483c48fe6 Re-balance file sizes. 2025-02-24 11:08:28 +00:00
jean-pierre charras
dc1ecea4bc OUTSET_ROUTINE::ProcessItem(): handle an exception thrown for incorrect prm.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19880
2025-02-07 19:47:48 +01:00
John Beard
43be371f83 Kimath: don't access aActual unless set
Avoids at least one test failure in qa_pcbnew
due to uninitialised access.
2025-01-24 20:26:31 +08:00
Seth Hillbrand
0281bfe05e Fix missing display pads on MacOS
The distance from any point in the negative quadrant to
std::numeric_limits::max will be larger than std::numeric_limits::max,
meaning that if we take the square of this value, we will overflow the
extended_type.  Overflows are undefined behavior when dealing with
signed integers (c.f. C99 §3.4.3/1) so while most compilers retain a
positive value, Apple, in release mode, overflows into the sign bit,
resulting in a negative number for the squared distance.

This prevented us from displaying certain shapes in the negative
quadrant on MacOS, only in release mode builds

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19424
2025-01-21 20:05:25 -08:00
jean-pierre charras
2a143a63e5 Build on MSYS2: use shobjidl.h, instead of shobjidl_core.h
shobjidl_core.h is not available on mingw
2025-01-16 09:59:12 +01:00
Marek Roszko
337ec6d862 Add a version_header depend, not ideal 2025-01-15 21:27:08 -05:00
Marek Roszko
a0b50622dd Implement AppUserModelID for windows 2025-01-15 20:36:15 -05:00
Alex Shvartzkop
3a0df97dbf Optimize SHAPE_LINE_CHAIN::Segment slightly. 2025-01-15 18:07:57 +05:00
Seth Hillbrand
5cd9e319d3 Handle more arc degeneracies 2025-01-14 13:08:45 -08:00
Seth Hillbrand
bfb3875a68 Add additional handling for arc collisions
Provides nearest point calculation for circles, segments and rects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18203
2025-01-14 13:08:45 -08:00
Seth Hillbrand
bcebc694b8 Implement MTV for arcs 2025-01-14 13:08:45 -08:00
Seth Hillbrand
b73481dd49 Update SHAPE_ARC::IntersectionPoints()
Force it to handle a number of edge cases from Arc-Arc collision test.
Unify and simplify the Collide Arc-Arc.  Add additional arc collision
QA test
2025-01-14 13:08:45 -08:00
Jeff Young
77a524fa22 Fix slicing operator.
(Also a minor performance improvement.)
2025-01-14 12:41:16 +00:00
Seth Hillbrand
3e8791b88d Fixup multiple issues with DP checks
Handle arcs properly even when not exactly concentric.  Properly check
for interfering elements that would prevent coupling.  Avoiding those
that are directly connected

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17967
2025-01-13 16:11:16 -08:00
Seth Hillbrand
8ab5d95d1b Handle GTK themes that don't use the revealer 2025-01-11 19:56:42 -08:00
Marek Roszko
06a61e773f Fix bg/fg fed to GetInfoBarColours 2025-01-11 16:26:02 -05:00
Jon Evans
4279672876 Fix incorrect signature 2025-01-10 21:59:51 -05:00
Seth Hillbrand
e8167f33d7 Grab GTK default colors for infobar
This implements the wxWidgets fix for KiCad.  We can't wait for distros
to update their wx libs so until then, we'll roll our own.

Nicely, this also implements the MacOS setting that was an ifdef
previously

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19506
2025-01-10 17:32:51 -08:00
Seth Hillbrand
452e69de85 Move thread pool into true singleton
Thread pool needs to be stored in a single location for all of KiCad
otherwise each kiface will spin up its own pool of persistent threads
2025-01-09 09:03:08 -08:00
Alex Shvartzkop
9a3d7594d9 Add pivot/pan/rotation/lights controls to PCB render dialog. 2025-01-05 11:42:58 +05:00