Commit Graph

318 Commits

Author SHA1 Message Date
Marek Roszko e83f87520c Transform is right at home in kimath 2023-09-07 18:03:33 -04:00
Alex Shvartzkop 21ee65aa9c ADDED: Importers for EasyEDA (JLCEDA) Standard / Professional. 2023-09-07 11:02:40 +03:00
Alex Shvartzkop 1b8abdfde7 ADDED: Basic STEP manipulation utils available to Python. 2023-09-07 10:57:02 +03:00
John Beard 78c8de9b08 Fix oval pad snapping
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
2023-09-06 21:33:45 +01:00
Josue 94e86a69be Update RECT to RECTANGLE 2023-08-29 11:50:22 -05:00
Josue e5316fd1aa Change name: Truncate -> Round 2023-08-29 11:50:12 -05:00
Josue 8d7255aae3 truncate angle values in Segment properties 2023-08-29 11:50:09 -05:00
Jon Evans 0714d3f1ab Fix SHAPE::Distance warnings 2023-08-22 08:30:47 -04:00
Jon Evans 0c529411d7 Update SHAPE_POLY_SET API to not hide virtual functions 2023-08-18 21:40:40 -04:00
Jon Evans bf0592ad53 Lift some point-vs-shape APIs into SHAPE base class
Also provide a virtual method for conversion to polygon
2023-08-17 08:02:14 -04:00
Alex Shvartzkop 040fd327ab SHAPE_POLY_SET: add BooleanXor() 2023-08-10 00:29:47 +03:00
Alex Shvartzkop 6d624ac1ff SHAPE_POLY_SET: allow constructing/adding/iterating with POLYGON 2023-08-10 00:29:33 +03:00
Jeff Young 0413270012 ADDED: Move Corner To... and Move Midpoint To...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5012
2023-08-05 16:43:55 +01:00
John Beard 046d978ba7 ADDED: Pcbnew chamfer and extend tools
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.
2023-07-12 19:21:37 +01:00
Mark Roszko e53e571d2d const bool is just bool 2023-07-08 01:02:59 +00:00
Seth Hillbrand 954b265839 Check for zone-zone overlap
Instead of just checking for the zone outline, we adjust to check the
full fill area of the zones for intersection and overlaps
2023-07-07 11:52:25 -07:00
Kuba Sunderland-Ober b938064e29 Fix missing consts. 2023-07-05 10:20:18 +00:00
Kuba Sunderland-Ober 1edb9bb0ce Get rid of VECTOR2U. 2023-06-28 20:48:07 +00:00
Jeff Young 40abb013ec Don't consider a group to be on a copper layer.
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
2023-06-20 18:13:21 +01:00
Jeff Young 5875f89531 Centralize text size clamping.
Also introduces alg::clamp to improve readability of
std::max( min, std::max( value, max ) )

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14876
2023-06-03 20:29:51 +01:00
Marek Roszko c31b5eb7d8 Fix errant typecast in VECTOR2<T>::Resize
This fails QA on Windows but not Linux
2023-05-29 19:34:40 -04:00
Jeff Young f5791f5dc6 Left some fixes out of previous commit. 2023-05-29 16:22:24 +01:00
Jeff Young 65e53b8ecd Move SHAPE_POLY_SET::Inflate's error spec from a seg-count to a max-deviation.
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
2023-05-29 15:29:03 +01:00
Jeff Young 4ed267394a Outline font performance improvements.
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
2023-05-27 01:35:40 +01:00
Jeff Young 29674051b4 Readability (no functional changes). 2023-05-21 16:22:14 +01:00
jean-pierre charras 52bf337b55 vector2d.h: fix for the fix of the awrning fix. 2023-05-21 16:06:15 +02:00
Marek Roszko c2e019b773 Fix warning fix 2023-05-21 08:09:49 -04:00
Marek Roszko 4eeae65411 Fix another warning
Cast the args with static_cast so the compiler knows its intentional
2023-05-20 08:05:14 -04:00
Marek Roszko 7774b75172 Another set of C5266 warning fixes 2023-05-18 22:46:57 -04:00
Marek Roszko 573b66d243 Fix a bunch of C5266 warnings (pointless const on bool/int returns)
warning C5266: 'const' qualifier on return type has no effect
Microsoft doesn't even document C5266
2023-05-18 21:35:06 -04:00
Seth Hillbrand f7f52d77e4 Rework Copper Sliver check
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
2023-04-25 10:32:46 -07:00
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