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)
The clearance epsilon should not be used to limit which force elements
we return in the query. Otherwise, we can drag elements into a
DRC-violating space
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16293
(cherry picked from commit 5e850911c5)
Most of our pointers will share the top 32 or more bits of their pointer
addresses, making cache collisions highly likely. This uses a hash
combiner to mix the bits more effectively
(cherry picked from commit e4756c811e)
If there is a small hole (smaller than the conn width), we can loop
around in a circle checking all points and not move past the mimimum
distance.
To avoid this, if we detect a loop, we exit the substantial checker.
This should return with true because a large hole will return true and
we are only checking to see if there is a minimum amount of copper
between two open areas
(cherry picked from commit c841d0df6d)
We can't assume that the ignored connection exists when trying to set
the junction size. We use int_max for the default instead of 0 so that
later, we don't try to create a minor track with 0 width in loadNets()
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17523
(cherry picked from commit 00d108498f)
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)
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)
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)
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)
Between schematic and pcb editors, we want the following actions:
- Single click on ERC/DRC item should show the item in the ERC/DRC
window. But if the window is not visible, it should only update the
status bar
- Double click on ERC/DRC item should show and raid the ERC/DRC window
as well as select the line item
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17383
(cherry picked from commit 0f57d76ecd)
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)
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17527
This is required as during an undo / redo operation, rebuilding
the previous selection can result in a group / generator being
selected as well as all of their contained items. This prunes
the contained items to remove the possibility of a double-delete.
(cherry picked from commit 6c73f1feef28925bf26fcc3669cb6333aad5f1d3)
Avoid issue when a copper layers thickness is 0 (min value is now 1 micrometer)
Fix incorrect rendering of plated graphic items and vias (vertical walls not drawn)
From master branch
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)
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)
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)
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)
The behavior of the measure tool is influenced by the
horizontal/vertical/45-degree mode, but the context menu of the measure
tool lacks an option to toggle this mode. In contrast, the drawing
tools are also affected by this mode, and their context menu has the
item to toggle this mode.
(cherry picked from commit 806daecf85)