Commit Graph

817 Commits

Author SHA1 Message Date
Alex Shvartzkop 768d4a6782 Wayland: fix cursor warping on KDE and Weston, add logging. 2023-09-18 12:56:54 +00:00
Alex Shvartzkop c49b19b0ce Don't set GDK_BACKEND=x11 when EGL is enabled in wx. 2023-09-18 12:56:54 +00:00
Alex Shvartzkop 06463fd35a Fixes for Wayland cursor warping:
- Emulate the mouse position, since no motion events are sent after warp
- Do not call wl_surface_commit to prevent an assert
- Re-organize code a bit
2023-09-18 12:56:54 +00:00
Clément Saccoccio ad62b165fe Fixed infinite mouse-drag with fast movement on Wayland. 2023-09-18 12:56:54 +00:00
Alex Shvartzkop 8db400500d Enable Wayland tricks by default when configured with KICAD_WAYLAND=1. 2023-09-15 00:30:54 +03:00
Alex Shvartzkop 89cb35dc22 Support pointer warping on Wayland.
Configure with KICAD_WAYLAND=1
2023-09-15 00:04:36 +03:00
Alex 3e710fe7c9 Wayland: add KICAD_WAYLAND_TRICKS env variable. 2023-09-14 03:54:01 +03:00
Marek Roszko 11de95778b Unwrap the FROM_UTF8 macro in favor of direct function
The extern just gets annoying to try to export the func later. We also yeet TO_UTF8 to string_utils.h for parity.
2023-09-09 00:10:57 -04:00
Marek Roszko ab1a6651a9 send multivector.h and sync_queue.h to core 2023-09-08 07:14:34 -04:00
Marek Roszko 1a6d459fb1 Fix wrong path slash 2023-09-07 22:09:26 -04:00
Marek Roszko 5da88d1d0e Move UTF8 to core 2023-09-07 20:55:16 -04:00
Marek Roszko e83f87520c Transform is right at home in kimath 2023-09-07 18:03:33 -04:00
Marek Roszko 7505fd0f37 Profile can live in core 2023-09-07 07:47:01 -04:00
jean-pierre charras 3e6f7ab3e5 Fix compil issues (especially easyeda_parser_base.xx) and compil warnings
Compil issues can be gcc13/msys2 specific.
2023-09-07 13:41:25 +02:00
Alex Shvartzkop 21ee65aa9c ADDED: Importers for EasyEDA (JLCEDA) Standard / Professional. 2023-09-07 11:02:40 +03:00
Alex Shvartzkop 05a8e59884 Move wxString and std::optional JSON serializers to core header. 2023-09-07 10:57:02 +03:00
Alex Shvartzkop 1b8abdfde7 ADDED: Basic STEP manipulation utils available to Python. 2023-09-07 10:57:02 +03:00
Alex Shvartzkop 52feb38fd1 Add map_helpers.h 2023-09-07 10:57:02 +03:00
Marek Roszko 96bec8c553 promote base64.cpp to core 2023-09-06 23:27:08 -04:00
Marek Roszko 5c62b98e7c observable can live in core 2023-09-06 21:25:24 -04:00
Marek Roszko 4d77fd48ef Shove thread_pool to core 2023-09-06 17:50:12 -04:00
John Beard 78c8de9b08 Fix oval pad snapping
Previously the snap points computed for oval pads didn't get all the
points correct. This breaks out the "find snap points for ovals"
into a function, reworks the logic, adds some tests.

Also adds "extremum points" when the oval isn't exactly H/V.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15594
2023-09-06 21:33:45 +01:00
Seth Hillbrand 7af5037ad7 Fix version compare for MSW 3D Connexion mouse 2023-08-30 15:10:45 -07:00
Josue 94e86a69be Update RECT to RECTANGLE 2023-08-29 11:50:22 -05:00
Josue e5316fd1aa Change name: Truncate -> Round 2023-08-29 11:50:12 -05:00
Josue 8d7255aae3 truncate angle values in Segment properties 2023-08-29 11:50:09 -05:00
Alex Shvartzkop a9a2d4aa7a Improve error reporting when running Python action plugins.
Python error traceback is now logged to stderr.
On Windows, a console window will pop up if wxTheApp gets destroyed,
because message dialogs crash due to hooks that wxWidgets sets up.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15520
2023-08-29 07:06:11 +03:00
Seth Hillbrand db8e15ce88 Require wxWidgets 3.2
Removes old defines and work arounds for earlier wx versions and adds a
CMake requirement to use at least 3.2 (or the minimum matching wxPython
version)
2023-08-23 22:02:56 +00:00
Jon Evans 0714d3f1ab Fix SHAPE::Distance warnings 2023-08-22 08:30:47 -04:00
Jon Evans 0c529411d7 Update SHAPE_POLY_SET API to not hide virtual functions 2023-08-18 21:40:40 -04:00
Marek Roszko 726f09f9ad Add a workaround to Nahimic crapware
Fixes https://gitlab.com/kicad/code/kicad/-/issues/11850
2023-08-17 22:46:22 -04:00
Marek Roszko 3f182a36c9 Silence uint32 to uint8 cast warning 2023-08-17 22:27:15 -04:00
Jon Evans bf0592ad53 Lift some point-vs-shape APIs into SHAPE base class
Also provide a virtual method for conversion to polygon
2023-08-17 08:02:14 -04:00
Alex Shvartzkop 040fd327ab SHAPE_POLY_SET: add BooleanXor() 2023-08-10 00:29:47 +03:00
Alex Shvartzkop 6d624ac1ff SHAPE_POLY_SET: allow constructing/adding/iterating with POLYGON 2023-08-10 00:29:33 +03:00
Jeff Young 0413270012 ADDED: Move Corner To... and Move Midpoint To...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5012
2023-08-05 16:43:55 +01:00
Jon Evans d2ec4834d9 Fix macOS impl of Valid3DConnexionDriverVersion 2023-07-27 08:30:08 -04:00
Seth Hillbrand 8546d417df Prevent dereferencing end iterator 2023-07-25 10:49:35 -07:00
Roberto Fernandez Bautista dadcc70a3d Partially revert 6cb80422
We don't need to touch cmake for anything (avoid confusion for future Devs)
2023-07-24 21:40:06 +00:00
Roberto Fernandez Bautista 6cb804228b Fix windows build
core needs to be linked after wxWidgets + use wide string literals
2023-07-24 22:59:41 +02:00
Seth Hillbrand 9902250f5d Fix a couple of issues with NAVLIB version checker
Need to include core lib in kiplatform for the version functions.  Need
to link kiplatform into the navlib library in eeschema to load
2023-07-24 13:55:12 -07:00
Seth Hillbrand 32ad42a435 Add 3dconnexion driver version check
Re-enable 3dconnexion driver by default as we are able to gate the
driver versions

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13362
2023-07-24 18:09:52 +00:00
Ian McInerney c26863cc1e Don't try to enable sequential mode on non-existant files on GTK
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15222
2023-07-18 21:03:28 +01:00
Marek Roszko c009328c07 Undo accidental commit from some time ago (woops) 2023-07-16 21:54:09 -04:00
Roberto Fernandez Bautista e7019cc7d2 Fix msvc warnings in kimath (add explicit casts) 2023-07-16 15:41:04 +02:00
Marek Roszko b0fa2561b6 Add support for enum based policies 2023-07-13 19:01:04 -04:00
Ian McInerney 5aff8b6a6e Switch to string_view in tool action construction
The TOOL_ACTION_ARGS construction method is supposed to be fairly light
weight, so instead of creating/destroying strings all the time, pass
string_views to the actual string data instead.

wx doesn't currently support string_view -> wxString implicitly
currently, so we have to do the conversion ourself.
2023-07-13 00:53:06 +01:00
John Beard 046d978ba7 ADDED: Pcbnew chamfer and extend tools
Using the new ITEM_MODIFICATION_ROUTINE system, drop in two new
tools: chamfer and line extend. These are two geometric operations
that are relatively common when editing footprints in particular.

Chamfer delegates the geometric calculations to a dedicated unit
in kimath/geometry.
2023-07-12 19:21:37 +01:00
Alex Shvartzkop f8f7b84f13 LTspice import: add LTspice 17.1 Windows library path. 2023-07-12 10:57:30 +05:00
Jeff Young a66360525a Broaden "Style footprint fields" to cover graphics as well.
Also cleans up the layout of the symbol & fp properties dialogs.

Also fixes the background colour of the link textEdit controls on Mac.

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

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15152
2023-07-09 12:45:55 +01:00
Mark Roszko e53e571d2d const bool is just bool 2023-07-08 01:02:59 +00:00
Seth Hillbrand 954b265839 Check for zone-zone overlap
Instead of just checking for the zone outline, we adjust to check the
full fill area of the zones for intersection and overlaps
2023-07-07 11:52:25 -07:00
Kuba Sunderland-Ober b938064e29 Fix missing consts. 2023-07-05 10:20:18 +00:00
Kuba Sunderland-Ober 1edb9bb0ce Get rid of VECTOR2U. 2023-06-28 20:48:07 +00:00
Jeff Young 4f52c69724 Better path handling for importing LTspice files. 2023-06-26 20:51:16 +01:00
Jeff Young 40abb013ec Don't consider a group to be on a copper layer.
Its members can be on copper layers, but the group itself isn't on any
layer.

Also fixes a bug where we were trying to clone TRIANGULATED_POLYGON::TRI
shapes as indexable sub-shapes.  (The TRI only has indexes into its
parent, so cloning it will only result in segfaults down the line.)

Also fixes a bug where we weren't including copper items inside groups
when checking footprint net ties.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15021
2023-06-20 18:13:21 +01:00
Jeff Young 840e4b6f72 Push fix for #14890 down a level.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15005
2023-06-19 18:05:37 +01:00
Alex Shvartzkop 3c742c71a0 GTK: Add workarounds for broadway and allow wayland GDK backend.
For testing. X11 backend is still used unless GDK_BACKEND=wayland
is set explicitly.
2023-06-13 09:42:20 +03:00
Jeff Young 0f8c5a96b2 Support shape collisions between SHAPE_POLY_SET and other shapes.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14890
2023-06-06 13:40:44 +01:00
jean-pierre charras 92018f0066 Fix minor compil warnings 2023-06-04 16:24:28 +02:00
Jeff Young 5875f89531 Centralize text size clamping.
Also introduces alg::clamp to improve readability of
std::max( min, std::max( value, max ) )

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14876
2023-06-03 20:29:51 +01:00
jean-pierre charras 6b845b9054 Fix compil warnings and a wxWidgets alert. 2023-05-30 09:00:46 +02:00
Marek Roszko c31b5eb7d8 Fix errant typecast in VECTOR2<T>::Resize
This fails QA on Windows but not Linux
2023-05-29 19:34:40 -04:00
Jeff Young f5791f5dc6 Left some fixes out of previous commit. 2023-05-29 16:22:24 +01:00
Jeff Young 65e53b8ecd Move SHAPE_POLY_SET::Inflate's error spec from a seg-count to a max-deviation.
1) Also reorders parameters to make sure the compiler helps out.

2) This also makes it harder to mess up the discrepency between
   BOX2I/wxRECT/etc::Inflate() and SHAPE_POLY_SET::Inflate.

3) Also fixes a couple of bugs where the corner strategy was passed
   in as a segCount.

4) Also fixes a couple of bugs where the error wasn't forced to the
   outside to match the ERROR_LOCATION.

5) Also fixes a couple of bugs where the seg count was specified
   without regard to an already passed-in max deviation
2023-05-29 15:29:03 +01:00
Jeff Young 4ed267394a Outline font performance improvements.
1) Don't fracture font glyphs when generating them; we're going
   to fracture during triangulation anyway.
2) Don't check for self-intersection when deciding to fracture.
   It costs nearly as much as the fracture does.
3) Cache drawing sheet text.
4) Use the current font when checking for cache validity.
5) Parallelize glyph triangulation.
6) Don't invalidate bounding box caches when offset by {0,0}
7) Use the glyph cache when generating text effective shape.
8) Short-circuit NormalizeJustification() if its center/center.
9) Don't triangulate for GuessSelectionCandidates()
10) Avoid sqrt whenever possible.
11) Pre-allocate bezier and SHAPE_LINE_CHAIN buffers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14303
2023-05-27 01:35:40 +01:00
Jeff Young 1282e00775 Fix (presumed) stale name in macOS KIPLATFORM::IO. 2023-05-25 11:26:09 +01:00
jean-pierre charras ff072feeb4 Fix an annoying compil warning on msys2 2023-05-25 11:09:58 +02:00
Seth Hillbrand 39ab2ea41f Fix typo in MSW io.cpp 2023-05-24 19:23:32 -07:00
Seth Hillbrand 48ecd742eb Maintain file permissions when renaming
Temporary and autosave files do not neccessarily have the correct
permissions set to replace existing project files.  This updates the
permissions to match the existing values where possible

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13574
2023-05-24 17:09:38 -07:00
Jeff Young 29674051b4 Readability (no functional changes). 2023-05-21 16:22:14 +01:00
jean-pierre charras 52bf337b55 vector2d.h: fix for the fix of the awrning fix. 2023-05-21 16:06:15 +02:00
Marek Roszko c2e019b773 Fix warning fix 2023-05-21 08:09:49 -04:00
Marek Roszko 4eeae65411 Fix another warning
Cast the args with static_cast so the compiler knows its intentional
2023-05-20 08:05:14 -04:00
Marek Roszko 7774b75172 Another set of C5266 warning fixes 2023-05-18 22:46:57 -04:00
Marek Roszko 573b66d243 Fix a bunch of C5266 warnings (pointless const on bool/int returns)
warning C5266: 'const' qualifier on return type has no effect
Microsoft doesn't even document C5266
2023-05-18 21:35:06 -04:00
Marek Roszko 3cd89eeffb Use a placeholder commit hash if we can't get a git hash
Makes CLI test happy on...build systems circa 1990s that don't just shallow copy the git repo
2023-05-17 21:24:26 -04:00
jean-pierre charras a2ec8bf0a4 Fix last changes in io.cpp for msys2.
- use the same code for msys2 and msvc
- add an option to use a fallback for msys2 if the common code does not compile
2023-05-11 12:51:53 +02:00
Marek Roszko dd8dc4e513 Add a sequential read flagged fopen helper
Trying to squeeze out some kind of gain by informing the OS we will read a file sequentially.
In particular our FILE_LINE_READER just uses fgetc until the end
2023-05-10 20:24:27 -04:00
Marek Roszko 6e93a0cbad Fix ImmControl implementation 2023-05-09 21:27:14 -04:00
Marek Roszko 5d93487607 Disable IME input on the gal canvas
Fixes #9719
2023-05-09 20:30:15 -04:00
Marek Roszko 18dd623122 Add env var to force logging on msw 2023-05-04 20:58:33 -04:00
Seth Hillbrand b72c6e5cb0 Avoid NaNs when applying fillets
Segments that are inline with each other will create NaNs when
filleting.  This double check prevents NaN points from being added to
the polygon
2023-05-03 11:50:03 -07:00
Seth Hillbrand f7f52d77e4 Rework Copper Sliver check
Adds QA checks to copper sliver tests.  Adds the following checks:
- Dot product between two arms (quickly avoids checks for >90°)
- Checks the sliver is convex (area test)
- Eliminates minor slivers with angles that are approximately 0 and ones
  with the opposite side width beneath a configurable level
- Updates Clipper2 to fix a couple of jagged edges on inflate
- Adds simplify during zone fill inflation to limit jaggies

Fixes https://gitlab.com/kicad/code/kicad/issues/14549
2023-04-25 10:32:46 -07:00
Marek Roszko ea077bc34d Banish ignore.h to core 2023-04-18 22:44:04 -04:00
Ian McInerney a77e94d16f Add hack to speed up font choice box widget creation
There are problems internal to GTK that mean creating choice boxes with
a lot of items is a very slow process. This hack works around one of
those issues to make it faster to create and display the menu in the
choice box.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14277
2023-04-12 15:23:34 +01:00
qu1ck 0c049eccc7 Fix a bunch of compiler warnings 2023-04-11 17:01:30 +00:00
Tomasz Wlostowski bfbda978b8 router: hole as first class objects, wip
Rebased by Jeff Young <jeff@rokeby.ie> 5 April 2023

(Also includes a bug-fix for highlighting collisions with edge-cut
items.)
2023-04-11 15:51:00 +01:00
Ian McInerney a0b5de91f3 Move forgotten file to core library
Turns out, there was a cpp file for hte core library, so turn the
library into a static library.
2023-04-08 00:37:49 +01:00
Ian McInerney deb2bc0ac8 Fix mistake in kimath wxWidgets include statement 2023-04-06 15:01:18 +01:00
Ian McInerney ea62b145ff Introduce core interface library
This library is meant to move non-EDA items (language extensions,
library extensions, etc.) into the lowest-level of our dependency chain.
This library should never depend on anyother non-thirdparty code in the
kicad codebase.
2023-04-06 15:01:18 +01:00
Nimish Telang 8ea357f04d Fix Doxygen directives in numerous headers 2023-03-24 13:02:13 +00:00
jean-pierre charras ac71227e75 Fix compil warnings. 2023-03-23 18:36:59 +01:00
Seth Hillbrand 97558b62ec Update to Clipper 1.2+
Updates to Clipper2 742614f, which includes bug fixes for specific KiCad
boards beyond Clipper2 itself

Fixes https://gitlab.com/kicad/code/kicad/issues/14294
2023-03-22 15:24:26 -07:00
Alex 98e635869f Improve anti-overflow in SEG::intersects.
Caused issues when testing against
A=( -INT_MAX, ... ), B=( INT_MAX, ... ) segments.

Fixes https://gitlab.com/kicad/code/kicad/issues/14293
2023-03-16 05:03:21 +03:00
jean-pierre charras 893a362d9e Minor Coverity and compil warnings fix. 2023-03-15 20:09:04 +01:00
jean-pierre charras e6945a85b0 fix compil and Coverity warnings. 2023-03-12 15:19:50 +01:00
Roberto Fernandez Bautista f1db501adb Fix warning in SHAPE_LINE_CHAIN::Slice 2023-03-11 16:18:53 +01:00
Jeff Young 43fa5e957f Fix shadowed variable warning. 2023-03-10 17:42:36 +00:00
Ian McInerney 5671a123b9 kimath: Fix some warnings 2023-03-10 16:38:35 +00:00
Ian McInerney 3ce4016221 kimath: Enable warnings
kimath was missed when the original warnings infrastructure was added,
so enable warnings in it now.
2023-03-10 16:38:35 +00:00
Ian McInerney 9292158c76 kimath: Switch from INT_MAX to std::numeric_limits 2023-03-10 16:38:35 +00:00
Ian McInerney bc28287fa7 Cleanup includes in kimath 2023-03-10 16:38:35 +00:00
Ian McInerney a6ebd60c3b CMake: Modernize Boost import to use imported targets 2023-03-10 16:38:35 +00:00
Jon Evans eba0783b38 Fix rotation/flipping properties for text boxes
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14159
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14164
2023-03-04 13:11:15 -05:00
Jeff Young d545216432 Prefer Clamp() to std::min( std::max() ). 2023-03-03 21:29:37 +00:00
Jeff Young 2f2a00c307 Overflow safety.
Potential fix for some or all of
https://gitlab.com/kicad/code/kicad/-/issues/13969
2023-03-03 21:29:37 +00:00
Seth Hillbrand 1fda68099f Prevent inf when presented with 0 errormax
acos(1) returns 0, so this implies infinite segements to get to 0 error.
This is not reasonable but might be encountered in bad arcs or circles
that have 0 radius.  Instead of returning infinite or std::max segments,
we limit the error to be at least 1 IU
2023-03-02 10:21:05 -08:00
Seth Hillbrand af10878954 Use Chamfer lines when deflating
Rounded line ends when deflating leads to microscopic jags in the
outline that are not visible but add substantial computation time and
minor error when computing polygon offsets.

Instead, the chamfer deflate method prevents these jagged lines by
clipping angles < 90° by the error level.  This does not impact deflate
calls where we explicitly require the angles to be maintained
2023-02-22 16:24:26 -08:00
Seth Hillbrand 01039b50ca Correct the formula for error
The radius should always be positive but simply reversing the sign of
the inner expression only works in some cases
2023-02-22 16:24:26 -08:00
Jon Evans 43d3a18b86 Improve HiDPI handling of appearance/layer controls 2023-02-22 09:20:36 -05:00
Marek Roszko d55e2049e5 Silence some warnings with static_casts 2023-02-18 23:36:50 -05:00
Marek Roszko aacc9746e3 Yeet the last of wxSize/wxPoint to stop leaking gdicmn everywhere 2023-02-18 22:57:18 -05:00
Seth Hillbrand 5a56b18b0e Revert "Update Clipper2 to version 1.1.1"
This reverts commit c594a0eba2.
2023-02-17 09:24:19 -08:00
Seth Hillbrand c594a0eba2 Update Clipper2 to version 1.1.1 2023-02-17 17:14:37 +01:00
Seth Hillbrand e7fe69b97f Better handling of vertex sorting
Nominally, the zcode of a vertex is unique.  This is not 100% true,
however, as we must interlace two 32-bit numbers into a single 32-bit
number.  Sorting needs to account for the possibility that the zcode
will be the same while other elements of the vertex are different.  This
commit fixes the broken boolean logic to more clearly handle these cases

Fixes https://gitlab.com/kicad/code/kicad/issues/13867
2023-02-13 11:21:04 -08:00
Seth Hillbrand e60152e351 Fix island removal when copper->edge clearance is 0
Just testing a single point to find copper that is outside the board works
until the arc->segment conversion moves the board outline just enough to
have the filled copper slightly (few IU) outside of the converted outline.

Instead, we do an expensive check of comparing the size of the
intersection between the island and the island's intersection with the
board.  If the intersection is at least half as large as the original
island, we can say with certainty that the island is inside.  The margin
could be much smaller than half but this preserves the intent without
picking an arbitrary number that might be violated

Fixes https://gitlab.com/kicad/code/kicad/issues/13717
2023-02-02 19:19:26 +00:00
Alex 04c82a42eb Add KICAD_ALLOC_CONSOLE environment variable to show console in GUI apps on Windows.
For debugging purposes, currently.
2023-02-02 01:12:34 +03:00
Jon Evans 563143951f macOS: Always show file type selector
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13716
2023-01-31 12:47:37 -05:00
Roberto Fernandez Bautista 0ecad1ef2e Add EDA_ANGLE::NormalizeNegative() and qa tests 2023-01-30 19:56:22 +00:00
Marek Roszko dd519f1b38 Remove WerSetFlags that was a pre-sentry test 2023-01-28 00:08:37 -05:00
Vincenzo Fortunato 42b4f49e7f Fix polygon self intersection check
Fixes https://gitlab.com/kicad/code/kicad/issues/13628
2023-01-26 22:56:47 +00:00
Alex 2f0dee40ea Use explicit coord type in GetClampedCoords. 2023-01-16 19:42:08 +05:00
Alex 2382764009 Fix cast in GetClampedCoords. 2023-01-15 15:10:39 +05:00
Alex 8c6eb4ce22 Extend types in GetClampedCoords. 2023-01-15 14:22:17 +05:00
Tomasz Wlostowski 4d208bac49 geometry: added SHAPE_SEGMENT::Is45Degree() method 2023-01-12 23:37:07 +01:00
Roberto Fernandez Bautista 33249d37b0 EAGLE SCH: Improve detail of curved shape imports (0.01mm error)
Follow-up from https://gitlab.com/kicad/code/kicad/-/merge_requests/1445
2023-01-10 22:45:46 +01:00
Roberto Fernandez Bautista ebce53d574 Allow specifying acuracy when appending an arc to a chain 2023-01-10 22:28:01 +01:00
Marek Roszko 570fa246ae Fix typo in matrix3 multiply, add unit tests 2023-01-05 21:06:52 -05:00
Marek Roszko 0e42cb19f2 Realize we can just describe the dxf arb axis with our MATRIX3x3 class 2023-01-04 20:42:56 -05:00
Jon Evans 68bc18425b Handle zero-size pads in CornerListToPolygon
Fixes https://gitlab.com/kicad/code/kicad/-/issues/13276
2022-12-26 10:04:03 -05:00
Jon Evans b85fab9ab6 Support DXF ellipses and elliptical arcs
Fixes https://gitlab.com/kicad/code/kicad/-/issues/12563
2022-12-24 22:46:07 -05:00
Seth Hillbrand 035ff27b76 Be smarter about checking SHAPE_POLY_SET intersect
The segment iterator creates segments when needed, so using it in a dual
loop creates NlgN more copies than we need.  This shifts to a single
copy algorithm that then uses a sorting to preemptively abort the search
once the segments are outside of the search bounding box

Fixes https://gitlab.com/kicad/code/kicad/issues/13191
2022-12-18 08:01:19 -08:00
jean-pierre charras ca2dde23d0 SHAPE_ARC::Collide(): fix incorrect returned position of colliding point.
The previously returned position had nothing to do with the colliding point.
2022-12-18 15:40:15 +01:00
jean-pierre charras 1047e7143a SHAPE_ARC::GetCentralAngle(): ensure a 360 deg arc angle is always returned as 360 deg.
An arc having the same start and end points can be 0 or 360 deg arc.
In Kicad it is always 360 deg arc (i.e. a circle)
Fixes #13182
https://gitlab.com/kicad/code/kicad/issues/13182
2022-12-17 14:44:53 +01:00
dsa-t f99bdb6078 Revert "Minor header cleanup."
This reverts commit 4277b25a0b
2022-12-08 05:04:41 +00:00
Alex 4277b25a0b Minor header cleanup. 2022-12-08 07:23:56 +03:00
Alex eb05d803df Use typename with extended_type. 2022-12-08 04:43:30 +03:00
Alex 1f1feb51d7 Fix GetVectorSnapped45 on distances > 1 m. 2022-12-08 03:59:47 +03:00
Alex 36ee9f72e2 Increase default padding to 1 in GetClampedCoords to avoid overflow msg. 2022-12-08 03:59:47 +03:00
Seth Hillbrand 83ced602a6 Free solution memory in Clipper2
The PolyTree64 memory is not automatically freed in the dtor, so call
this explicitly
2022-12-04 16:50:27 -08:00
Seth Hillbrand 73398e07a8 Fracture self-intersecting polygons
Self-intersecting polygons may form a hole after simplification, so make
sure that we fracture them as well to clear the hole

Fixes https://gitlab.com/kicad/code/kicad/issues/13067
2022-12-03 12:08:48 -08:00
Seth Hillbrand bd40684ecd Handle polygons' triangulation
Graphic polygons may be invalid and so need to be explicitly simplified
before triangulation.

Also clean up hole handling in triangulation routine
2022-11-28 15:46:12 -08:00
Seth Hillbrand 77770ff313 Revert "Ensure bad polys get simplified before triangulation"
This reverts commit fcf44091d2.
2022-11-28 12:38:16 -08:00
Seth Hillbrand fcf44091d2 Ensure bad polys get simplified before triangulation
If the poly set is self-intersecting, the triangulation may be
problematic and the full set needs simplification before.  We don't do
this uniformly because the simplification can be a slowdown if it is not
needed

Fixes https://gitlab.com/kicad/code/kicad/issues/12806
2022-11-28 10:37:37 -08:00
Jeff Young 4aff5c7618 Keep courtyard caches alive during move.
Fixes https://gitlab.com/kicad/code/kicad/issues/12999
2022-11-25 17:20:11 +00:00
Alex 5e7c4b734c Small optimizations in DRC and SHAPE_POLY_SET. 2022-11-17 02:10:22 +05:00
Marek Roszko 3dd2ae762d Refactor step export to use our normal board processing routines 2022-11-12 21:27:10 -05:00
Tomasz Wlostowski 0a69340953 geometry: fix incorrect 45 degree miter generation (likely a side bug after introduction of EDA_ANGLE) 2022-10-31 11:49:31 +01:00
Tomasz Wlostowski cd29dcf6e0 libs/kimath: SHAPE::Format() can now produce C++ object construction and simple test dump of shapes 2022-10-31 11:17:31 +01:00
Seth Hillbrand 8e97855557 Fix Clipper2 handling of Inflate/Deflate
For unknown reasons, Clipper2 only returns Paths structures from the
ClipperOffset::Execute routine.  Further, the Paths are not properly
ordered (outline->hole in outline, outline2->hole in outline2).
To get proper hierarchy, we need to run an additional pass of the
solution with the paths as Subject in a null union.  This is effectively
a Simplify() call but we keep the data in Clipper format to reduce the
churn/calc time
2022-10-28 17:01:36 -07:00
Seth Hillbrand 546e16a002 Add multi-level fallback in tesselation
Some clipper cases do not get resolved with the `FAST` mode, so in those
cases, do a second pass in the `SIMPLE` mode.  If both fail, return a
broken polygon instead of an infinite loop

Fixes https://gitlab.com/kicad/code/kicad/issues/12761
2022-10-28 10:17:58 -07:00
Seth Hillbrand 4cdf0bd6c9 Clipper2: Handle nested poly/hole/poly returns
In Clipper1, we had a flat tree structure on returns.  Clipper2 nests
these, so we need to properly handle the nesting structure when
importing the polygons
2022-10-21 16:14:34 -07:00
Jeff Young d16b23d16e Name shortening and line-break reduction. 2022-10-21 18:41:39 +01:00
Seth Hillbrand 27add591ec Add Clipper2
Currently this lives behind the advanced config flag `UseClipper2`.
Enabling this flag will route all Clipper-based calls through the
Clipper2 library instead of the older Clipper.  The changes should be
mostly transparent.

Of note, Clipper2 does not utilize the `STRICTLY_SIMPLE` flag because
clipper1 did not actually guarantee a strictly simple polygon.
Currently we ignore this flag but we may decide to run strictly-simple
operations through a second NULL union to simplify the results as much
as possible.

Additionally, the inflation options are slightly different.  We cannot
choose the fallback miter.  The fallback miter is always square.  This
only affects the CHAMFER_ACUTE_CORNERS option in inflate, which does not
appear to be used.

Lastly, we currently utilize the 64-bit integer coordinates for
calculations.  This appears to still be faster than 32-bit calculations
in Clipper1 on a modern x86 system.  This may not be the case for older
systems, particularly 32-bit systems.
2022-10-19 16:25:45 -07:00
Jeff Young e5de56b6cc Fix edge case in arc collision.
SHAPE_ARC::IntersectLine() fails when one of the arcs start points
is on the center point of the other -- in this case we can't extend
the line to the arc intersection because one point does not define
a line....

Fixes https://gitlab.com/kicad/code/kicad/issues/12609
2022-10-09 23:05:15 +01:00
Jeff Young e866dfe137 Avoid trying to draw empty pads.
Fixes https://gitlab.com/kicad/code/kicad/issues/12605
2022-10-09 20:28:54 +01:00
Jeff Young 19d270fe74 Text size sanity checking for TEXT_ITEMS_GRID.
Oh dear, there was a bunch going on here.  Firstly the move from int
to long long int for ValueFromString() means that we were no longer
catching overflows (as we were C-style casting it back to int in many
places).  But even when the overflow is caught, it would run in to
wxWidgets' empty string bug while trying to log it.

Fixes https://gitlab.com/kicad/code/kicad/issues/12577
2022-10-06 13:19:08 +01:00
Tomasz Wlostowski 26b2fd36d4 libs/kimath: fix divide by 0 for 0-length segments 2022-10-05 22:40:47 +02:00
Alex 6e0d940b98 kiplatform: Add quotes to restart registration command line. 2022-10-05 20:30:46 +03:00
Tomasz Wlostowski f80b48e1b0 libs/kimath: consider signed distances in parallelity check 2022-10-05 14:38:05 +02:00
Tomasz Wlostowski 6ed3618ce5 libs/kimath: improve numerical robustness of ApproxParallel/ApproxCollinear for segments of largely different lengths 2022-10-04 20:55:08 +02:00
jean-pierre charras ca5d87e46d disable CONIN$ and CONOUT$ redirection on mingw. it creates issues
(nothing printed on the console)
It is probably not needed on mingw/msys.
2022-10-04 19:51:52 +02:00
Mark Roszko fb8a4c10f7 Shove kicad2step into pcbnew itself with a new cli 2022-10-04 01:53:37 +00:00
Marek Roszko 2b42163379 Bind stdout and stderr for windows so that the console can get output 2022-09-29 18:51:01 -04:00
Jonathan Haas 9d45b5a197 Change implementation of Box2::FarthestPointTo to actually return the farthest point. 2022-09-27 22:40:55 +00:00
Alex 796e44d1e6 Fix a mistake in BOX2::Inflate. 2022-09-25 08:33:52 +03:00
Alex 58b03b0a1c Small optimizations. 2022-09-22 17:22:04 +00:00
Jeff Young 7e97dc6974 Fix typo found by dsa-t. 2022-09-20 10:50:22 +01:00
Marek Roszko 3d5913c825 Remove convert_to_biu.h, merge contents to base_units.h 2022-09-16 21:09:28 -04:00
Jeff Young 281b9d405a ADDED ability to specify where pad number (& net name) go on custom shaped pads.
Fixes https://gitlab.com/kicad/code/kicad/issues/6627
2022-09-14 11:37:20 +01:00
Jeff Young fc74de81fb Don't crash on empty SHAPE_LINE_CHAINs.
Fixes https://gitlab.com/kicad/code/kicad/issues/12407
2022-09-13 13:28:00 +01:00
Jeff Young 9188838e50 RIP EDA_RECT. 2022-08-31 23:57:24 +01:00
Jeff Young b4492e0bd2 More EDA_RECE yeetage. 2022-08-31 17:19:50 +01:00
Jeff Young f17a865593 Move EDA_ITEM hitTest to BOX2I. 2022-08-31 17:18:45 +01:00
Jeff Young c7036ae076 Beef up BOX2's API so it can replace EDA_RECT. 2022-08-31 00:44:33 +01:00
Seth Hillbrand b736460e71 Move optional access from value() to *operator
`value()` throws.  Where we check for existence, we don't need to use
the throwing version and should just use the unprotected variant
2022-08-30 13:59:39 -07:00
Seth Hillbrand df8b7a8fef Fix RemoveNullSegments 2022-08-29 17:08:01 -07:00
Seth Hillbrand a7f978daf6 Fix typo 2022-08-26 16:58:21 -07:00
Seth Hillbrand 5a37211fdb Handle cases where Simplify removes all outlines
This could theoretically happen for a fully degenerate polygon

Fixes https://gitlab.com/kicad/code/kicad/issues/12120
2022-08-26 16:41:57 -07:00
Seth Hillbrand 146495672e Utilize our combine_hash routine for multiple hash
We should be using the one routine every time we want to build a hash
from indepedent values rather than rebuilding it differently in multiple
places
2022-08-26 08:45:13 -07:00
Seth Hillbrand 06786c34d7 Blacklist hashes for 2d integer elements
The hash table for integer hashes is extremely limited and places most
elements in the same buckets.  This leads to a linear search time for
structures built on this.

This blocks hashes, directing the coder to utilize std::set or std::map
structures instead of hash tables for implementing integer-based
lookups.
2022-08-26 08:43:37 -07:00
Seth Hillbrand f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07:00
Marek Roszko f63a099fad Remove unused function to squash warning 2022-08-21 18:23:28 -04:00
Roberto Fernandez Bautista 1fa1b44d02 Fix SHAPE_LINE_CHAIN::Simplify() when there are only 3 points in the chain
We weren't updating m_shapes properly.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11695
2022-08-19 20:49:49 +01:00
Jeff Young 96f01d33c8 Performance improvements.
1) Move a bunch of std::map's to std::unordered_map to get constant-time
look-ups
2) Lengthen progress-reporting intervals to spend more time doing work
and less time talking about it
3) Reverse order of SHAPE_LINE_CHAINs in thermal intersection checks to
make (much) better use of bbox caches
4) Don't re-generate bboxes we already have
5) Fix some autos that weren't by reference (and were therefore copying
large datasets)
6) Rename delta progressDelta so it's easier to search for in future
7) Get rid of a few more autos (because I don't like them)
8) Pass large items to lambdas by reference

Fixes https://gitlab.com/kicad/code/kicad/issues/12130
2022-08-03 11:59:42 +01:00
Seth Hillbrand 3594a06475 Fix simplify routine
The change in c9c31fcbc2 missed a number of cases.  This reverts back to
the system as it existed before 2be352b9f9
but using the revised method of determining A-B-C distance and avoiding
resizing the arrays

(cherry picked from commit 675a5a6e7b)
2022-08-01 09:50:17 -07:00
Seth Hillbrand 2039a1bc8b Don't resize vectors in hot loops
Fixes a slowdown caused by erasing elements from the middle of a vector
during a hot loop in SHAPE_LINE_CHAIN::Simplify().  This gets called
quite a bit when loading boards and updating lines, so it needs to be as
fast as possible

Fixes https://gitlab.com/kicad/code/kicad/issues/12115

(cherry picked from commit c9c31fcbc2)
2022-07-31 12:48:52 -07:00
Seth Hillbrand f6d2164cb0 Fix crash in PNS walkaround
Placing via in walkaround mode and colliding with an arc triggered an
unneeded assertion.

Also fixes the bad assertion format that did not receive strings

(cherry picked from commit df9cf0a0c3)
2022-07-28 09:40:41 -07:00
jean-pierre charras 81d9524e03 Fix missing header. 2022-07-25 18:41:38 +02:00
jean-pierre charras 130723ebac VECTOR2D CalcArcCenter( VECTOR2D& aStart, VECTOR2D& aEnd, EDA_ANGLE& aAngle ):
fix broken calculation of arc center for arcs > 180 degrees.
Fixes #11708
https://gitlab.com/kicad/code/kicad/issues/11708
2022-07-25 18:23:52 +02:00
Jeff Young 032708860b Include both text shapes and border shapes in textbox.
Fixes https://gitlab.com/kicad/code/kicad/issues/11806
2022-07-25 16:10:08 +01:00
Seth Hillbrand 00f0d229bf Fix incorrect comment in previous commit 2022-07-21 15:52:54 -07:00
Seth Hillbrand 16e3d40552 ADDED: Display calculated clearance in status bar
In addition to showing resolved clearance, we also show the calculated
clearance in the same method as is used for DRC.  This will allow users
to better examine their system while working.

Fixes https://gitlab.com/kicad/code/kicad/issues/7934
2022-07-21 15:44:48 -07:00
Jeff Young b727bfc16d Performance: avoid sqrt at all costs. 2022-07-16 18:42:32 +01:00
Alex c107abe247 math: Use intrinsic functions for 64-bit rescale on MSVC. 2022-07-16 17:37:50 +00:00
Seth Hillbrand eccbb374a0 Add debug message to VECTOR3 check 2022-07-16 17:28:40 +00:00
Marco Langer 1606bfc9f8 fixed a runtime divide by zero crash for integral type template instanciations and made the class trivial copyable to increase performance 2022-07-16 17:28:40 +00:00
Alex 27869b1a37 Don't recalculate constants at every call in isqrt. 2022-07-16 14:53:18 +00:00
Jeff Young 0953395c87 LIB_SHAPE slightly abuses SHAPE_POLY_SET by using it for line chains.
Fixes https://gitlab.com/kicad/code/kicad/issues/11956
2022-07-08 21:35:40 -06:00