Commit Graph

569 Commits

Author SHA1 Message Date
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