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
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
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)
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.
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.
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
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
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
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
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
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
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
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.
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
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
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
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
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
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
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
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
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
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.
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