Commit Graph

773 Commits

Author SHA1 Message Date
Seth Hillbrand fb82130530 Fixup cherry-picks for v8 2024-06-29 11:22:11 -07:00
Seth Hillbrand 471f72a340 Handle arcs dp coupling
Calculate coupled arcs and spacing

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

(cherry picked from commit 75ab3d9e8b)
2024-06-29 11:22:11 -07:00
Alex Shvartzkop 37dd7c6df9 Backport BOX2I_MINMAX. 2024-06-20 18:49:32 +03:00
Jeff Young 245894e8eb Pull netname bug fixes and performance improvements back from master. 2024-06-14 19:01:37 +01:00
Alex Shvartzkop 96370f6665 Make sure to add start points to arcs in TransformOvalToPolygon.
Otherwise the long line segments can be non-parallel to the centerline.

This was the root cause of the slowdown in https://gitlab.com/kicad/code/kicad/-/issues/18156

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

(cherry picked from commit 76b2741a92)
2024-06-09 22:49:58 +03:00
Jon Evans a1cd73e730 Fix bad clearance logic in cecc1a2f 2024-05-23 11:21:18 -04:00
Jon Evans cecc1a2ff1 Use true arc collision for segment<>arc
Using an approximation here results in different collision
results for segment<>arc than point<>arc, which
can cause odd behavior in the router.


(cherry picked from commit 5b3b0ff836)

Co-authored-by: Jon Evans <jon@craftyjon.com>
2024-05-23 12:58:01 +00:00
Seth Hillbrand 0a227ea916 Avoid int overflow in collisions
When calculating arc collisions, avoid overflowing the integer distance,
which gives a false nearest point
2024-05-20 15:08:12 -07:00
Seth Hillbrand 160a493885 Ensure that arc closest positions are matched
We switch from squared to absolute calcualtion when calling into the arc
collision so be sure to catch the new positions and distances
2024-05-20 15:08:12 -07:00
Marek Roszko 7e04a1b8d3 Hackfix macOS to keep erc/drc on top
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14356
2024-04-27 13:38:41 -04:00
Mark Roszko aea70a14ff Fix win32 proxy parsing when the old IE options for scheme based configuration was set
If you uncheck in the old IE options "Use the same proxy server for all protocols", then it returns an annoying string
like http=blah:1232;https=blah:1232;ftp=blah:2321 which we have to parse.


(cherry picked from commit 60d5780c1c)

Co-authored-by: Marek Roszko <mark.roszko@gmail.com>
2024-04-27 17:30:03 +00:00
dsa-t 87f3d45109 Require Wayland 1.20 libraries.
KiCad doesn't build with older versions due to missing definitions.


(cherry picked from commit e26778c599)

Co-authored-by: Alex Shvartzkop <dudesuchamazing@gmail.com>
2024-04-27 17:26:57 +00:00
Seth Hillbrand e808ab7409 Re-add routine to remove duplicate points
The router needs to elimitate duplicate points but keep colinear
segments.  This re-creates the partial routine from the old Simplify()
function

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

(cherry picked from commit 59f99d9a6a)
2024-04-11 14:20:50 +03:00
JamesJ 026685ee48 Check a SHAPE_POLY_SET outline exists before attempting to get it by index
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17687
2024-04-06 20:17:39 +02:00
Seth Hillbrand e0381f25f7 Prevent OOB access in polygon split
Check for vertex placement against original size.  Since we are
potentially adding vertices that are out of order with the original
polygon, we only want to check against the first set of vertices when
checking for polygon collision

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

(cherry picked from commit 8260c174e9)
2024-04-02 11:23:30 -07:00
Seth Hillbrand b21165722b Forward and reverse test for point in poly collisions
(cherry picked from commit 4e6cd0d293)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 0dc894356b Check singular arcs connection
Even if there are no other segments in the line chain, we still should
check for arc connections in cases of individual arcs on a line chain

(cherry picked from commit 6b915049d1)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 892c5726f5 Move logging message after vertex check
When creating the list, we may have fewer than needed vertices, which
prevents calculating the area

(cherry picked from commit 6c05f2c67c)
2024-04-01 17:55:29 -07:00
StefanBruens b9b4ff6f5e Fix triangulationValid check race for zone fill
The m_triangulationValid flag is used in several places without holding
the mutex, thus it should only ever be set when the triangulation is
guaranteed to be valid.

This can either be done by protecting both data and flag by the same
mutex, or updating the flag only after the triangulation has finished.

Also fix the case when the triangulation actually fails, the flag should
not be set in this case.

While at it, simplify the recalculation check. Only if both the
triangulation is valid, and the data hash is unchanged the recalculation
can be skipped - this is typically the case when two threads try to
update the cache concurrently, the second one will block at the mutex,
and will see the valid data after the first thread has finished.

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

(cherry picked from commit e07b4ce8e4)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 734222bd88 Fix race condition in zone fill
When checking collisions, the SHAPE_POLY_SET::Collide() routine is not
const because it will regenerate the triangulation cache if it is out of
date (using a const_cast, grrr).  This sidesteps the issue by assigning
a mutex to the triangulation caching

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

(cherry picked from commit 81cb6d0c3f)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 01590385c7 Handle issue with alternate SHAPE_LINE_CHAIN
SHAPE_LINE_CHAIN_BASE can include things that are not SHAPE_LINE_CHAIN
like the triangle SHAPE_LINE primitive.  To check arcs, we need to avoid
these elements as they do not have the full SHAPE_LINE_CHAIN class
available.

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

(cherry picked from commit 347c50b26d)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 9be4bf0d14 Fix slow selection time when calculating clearance
The clearance between two zones could be rather slow.  This was in part
to trying to do triangle-triangle collisions between zones when we only
need outline collision and in part to the shape_line_chain collision
routine.  The shape_line_chain collisions don't need to recreate
segments on each iteration and should instead create them once and using
this to check all collisions

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

(cherry picked from commit 3cc1617f5a)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 1e13a7640e Tidy up some remaining triangulation cases
Found and fixed a few corner cases where triangulation point removal
could reset expected points

(cherry picked from commit 553e4a25bf)
2024-04-01 17:55:29 -07:00
Seth Hillbrand 890376d04f Do not use cache when we modify vertices
When we add vertices to the tesselation routines, we cannot reuse these
without the original vertex points.

It may be possible to copy and modify the vertices from the hint data so
that they are properly positioned but naive attempts (moving based on
first point) did not work, so for now, we disable the hint cache when
the vertex sizes do not match as this prevents OOB access

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

(cherry picked from commit 06b199fd41)
2024-03-31 15:01:16 -07:00
Seth Hillbrand 92ffd898f5 Update triangulation to handle poly-intersection
Polygon intersections happen against the original outline, not against
the currently remaining polygon.  This avoids pathalogical cases

Adds new simplification system to avoid duplicated points
Adds new edge-splitting algorithm to provide additional fall-back
Verifies that polygon cuts do not swap holes for outlines (negative
area)

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

(cherry picked from commit c3f6a84d66)
2024-03-28 13:55:06 -07:00
Céleste Wouters 76e0f94532 Improve SHAPE_POLY_SET fracture performance
Refactors `SHAPE_POLY_SET::fractureSingle()` to be more efficient, while
not changing the actual algorithm:

* increase cache locality by using contiguous arrays instead of what was
effectively a linked list
* reduce latency and jitter by replacing per-edge allocator calls with
ahead-of-time std::vector reserves
* increase cache efficiency by making the vertex struct smaller
* replace O(n^2) leftmost edge search with O(n log n) std::sort
* sort the polygons instead of the edges
* cut iteration count in half in the remaining O(polygons * edges) part

(cherry picked from commit e98c9f283f)
2024-03-28 13:10:43 -07:00
Seth Hillbrand ff2d0cfb10 Fix typo in triangulation return
(cherry picked from commit a793fa8b17)
2024-03-28 13:10:43 -07:00
Seth Hillbrand 1cc10be443 Skip small triangles
The minor triangles cost the same amount of compute time as larger ones
but do not have a material effect on the zone display.  This skips these
minor triangles when earcutting

(cherry picked from commit a58e7b37ff)
2024-03-28 13:10:43 -07:00
Seth Hillbrand d2db96886d Add logging and area check to tesselation
Logging is useful when we find an area that cannot be triangulated.
This will be used to generated test cases.

Skipping minor untesselated areas means that the polygon will still be
considered fully tesselated (and not sent back again and again) even if
the tesselation misses an area less than the configured limit.
Currently, this is 31^2nm.

(cherry picked from commit 7e7fec69f6)
2024-03-28 13:10:43 -07:00
Seth Hillbrand 3d4a7c7c3f Update triangulation
(cherry picked from commit 4f03bb2fb6)
2024-03-28 13:10:43 -07:00
Alex Shvartzkop ddec1d5317 Disable infinite panning when using XWayland.
Cursor warping doesn't work properly in this scenario.

https://gitlab.com/kicad/code/kicad/-/issues/14109
(cherry picked from commit 463b609993)
2024-03-15 01:17:50 +03:00
Alex Shvartzkop 6df17bba99 Fix rendering/plotting of arcs with tiny angle and huge radius.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17343

(cherry picked from commit 4d66a8ebdb)
2024-03-15 01:17:50 +03:00
Alex Shvartzkop 2ad3ccc4d8 Use 64-bit type to represent microseconds.
int and long are 32-bit on Windows, causing overflows.

(cherry picked from commit 85b1978408)
2024-03-03 21:47:23 +03:00
Jan Wichmann 64f8310a94 Don't show hidden directories and files in the project tree browser
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16207


(cherry picked from commit 5cdf9fe8a0)

4b9fffa3 Don't show hidden directories and hidden files in the Project tree browser
c433874c Changed file name conversation to utf16
aeba54ba Moved os-specific function to lib KIPLATFORM::IO
561709ac Implemented KIPLATFORM::IO::IsFileHidden for all plattforms
2024-03-03 16:47:38 +00:00
Roberto Fernandez Bautista 64382a85fa SHAPE_LINE_CHAIN: Fix indices rotation after clipper
Also fix IsArcStart and IsArcEnd functions to work with chains that only
have arcs.
2024-03-02 18:22:18 +01:00
Roberto Fernandez Bautista 4c51391cf6 SHAPE_LINE_CHAIN: Move .h definitions to .cpp
No functional changes, just allow faster rebuilds
2024-03-02 18:22:18 +01:00
Roberto Fernandez Bautista 5add7a0ca0 SHAPE_LINE_CHAIN: Fix/unify constructors 2024-03-02 18:22:18 +01:00
Alex Shvartzkop 711c6141a8 Highlight nets and show length tuning status when adding tuning patterns.
Also fixes length preview when hovering over joints.
Also prevents asserts when hovering over arcs.
Also prevents adding a tuning pattern on other tuning pattern.
2024-02-23 17:22:20 +00:00
Alex Shvartzkop ed115075ce Add size range check to BOX2::Inflate. 2024-02-23 17:22:20 +00:00
Jeff Young 162e8962f7 Add a cache for TrueType contours and triangulation data.
Also returns minimumSegmentLength to its former value as
it doesn't appear to be required to fix
https://gitlab.com/kicad/code/kicad/-/issues/11463.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16568
2024-02-22 23:36:16 +00:00
Seth Hillbrand 745c52c2b7 Update triangulation
Allow for overlapping points in input polygon.  This is relatively
common on a grid and should be used as potential split points to shave
additional ears

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16933
2024-02-12 15:20:08 -08:00
Jeff Young 11f5908761 Revert the SHAPE_ARC::Collide() part.
The arc width appears to be handled elsewhere (at least in
the test suite).

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16951
2024-02-12 17:51:14 +00:00
Seth Hillbrand c6c1dbb844 Don't skip caching triangulation for failure
Failed triangulation can have multiple causes but we don't have another
approach, so skipping the cache just causes the same issue to be raised
again and again

Fixes https://gitlab.com/kicad/code/kicad/-/issues/16946
2024-02-12 09:39:22 -08:00
Jeff Young d5ac0ff768 Fix SHAPE_ARC::BBox() and Collide() to honour m_width.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16951
2024-02-12 16:59:57 +00:00
Jeff Young 1ff36f23b8 Clean up stale TODOs. 2024-02-05 15:49:57 +00:00
Ian McInerney d44b04978a Allow enabling WXTRACE in release builds on all platforms
Setting the environment variable KICAD_ENABLE_WXTRACE now enables wx
trace logging on all platforms. MSW still requires its original
environment variables to be set to get the console displayed.
2024-02-02 14:21:33 +00:00
Alex Shvartzkop 1122d80388 Better support for arcs in tuning patterns. 2024-01-31 23:38:05 +03:00
Roberto Fernandez Bautista 7276486756 Finish fixing SHAPE_LINE_CHAIN::Slice 2024-01-31 19:17:46 +03:00
Roberto Fernandez Bautista 79aba50c23 Finish fixing SHAPE_LINE_CHAIN::NextShape and add tests 2024-01-31 19:17:46 +03:00
Roberto Fernandez Bautista e950475bc3 Add assert to SHAPE_LINE_CHAIN::Segment + Deduplicate code
CSegment should have the exact same logic as Segment

Also, moving definition to .cpp file to reduce need to rebuild every time
2024-01-31 19:17:46 +03:00