971 Commits

Author SHA1 Message Date
Jeff Young c960f69a9b Equality for doubles. (Potentially KICAD-SV8) 2025-07-06 21:57:23 +01:00
Mark Roszko 1696d75471 Provide custom coloring for Control Light / wxSYS_COLOUR_3DLIGHT 2025-06-14 15:57:23 -04:00
Mark Roszko b83f433506 Enable dark mode on windows when built with wx 3.3 2025-06-14 13:55:02 -04:00
Jeff Young 307f3c17bc Revert div-by-0 fixes which fail arc regression tests. 2025-06-09 20:09:24 +01:00
Jeff Young c5a053d51c Div-by-0 safety. 2025-06-09 12:54:30 +01:00
Jeff Young 265d273f93 Negative number safety. 2025-06-08 16:33:04 +01:00
John Beard d15b2b7305 SHAPE_ARC: Fix GetCentralAngle normalization documentation
This appears to have always been [-360 .. 360], as some tests in
test_shape_arc.cpp have had negative values for a very long time.

Add tests on the start, end and central angle accessors to enforce
the documented normalizations.
2025-06-08 09:55:54 +08:00
Jeff Young 31c6c28882 Performance optimizations. 2025-06-06 18:25:20 +01:00
Marek Roszko 54780ae0d4 Fix nuisance warning about unreachable return 2025-06-05 21:29:54 -04:00
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 b47bf99632)
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