Commit Graph

287 Commits

Author SHA1 Message Date
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
Nimish Telang 8ea357f04d Fix Doxygen directives in numerous headers 2023-03-24 13:02:13 +00: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
Ian McInerney bc28287fa7 Cleanup includes in kimath 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 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
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
Roberto Fernandez Bautista 0ecad1ef2e Add EDA_ANGLE::NormalizeNegative() and qa tests 2023-01-30 19:56:22 +00: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 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
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 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
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
Marek Roszko 3dd2ae762d Refactor step export to use our normal board processing routines 2022-11-12 21:27:10 -05: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 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 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 6ed3618ce5 libs/kimath: improve numerical robustness of ApproxParallel/ApproxCollinear for segments of largely different lengths 2022-10-04 20:55:08 +02: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
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 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