Commit Graph

360 Commits

Author SHA1 Message Date
Roberto Fernandez Bautista dd65ce9523 Simplify & move new arc collision code into Kimath library
Don't need to check intersections with the circle, just fix the
calculated "projected" point from the end points.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8234
2021-08-05 17:45:12 +01:00
Roberto Fernandez Bautista b6be10f05c Fix CIRCLE::Intersect( const SEG& aSeg ) and add unit tests 2021-08-05 17:45:12 +01:00
Roberto Fernandez Bautista 318435aedb Add more test cases: simulate zone fill around arc + diff pair meander 2021-08-05 17:45:11 +01:00
jean-pierre charras b6664eecf2 arc: fix incorrect arc center calculation for angle < 0 or > 180 deg 2021-08-05 18:15:55 +02:00
Jeff Young c00f4ed5d2 Add regression tests for track cleaner. 2021-08-03 16:17:18 +01:00
david-beinder 3a833debea ShapeToPolygon: implement negative inflation
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8859
2021-07-28 10:37:56 +00:00
Wayne Stambaugh 78e5e98ea0 Pass VECTOR2I objects by reference instead of on the stack. 2021-07-27 08:41:27 -04:00
Wayne Stambaugh 8fd83cbb95 Pass wxPoint objects by reference instead of on the stack. 2021-07-26 15:35:33 -04:00
Jeff Young 4760480f40 Quiet compiler warnings. 2021-07-22 13:03:17 +01:00
david-beinder 937e4b1d8c ShapeToPoly: Fix outline/arc intersection for large expansions
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8820
Adds shortcut code path for 90deg corners
Segments are now actually symetrical
Refactored and commented the code
2021-07-22 11:53:08 +00:00
Wayne Stambaugh 4c457b5ed3 More NULL expunging. 2021-07-18 14:31:55 -04:00
jean-pierre charras 25e9d17722 Fix a boost compatibility with old boost versions.
(replace boost::optional::has_value() by its definition is_initialized())
2021-07-16 14:01:26 +02:00
david-beinder 8b3ccab0a3 Implement explicit polygon construction for most pad shapes
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8650
2021-07-13 14:51:58 +00:00
jean-pierre charras 54b6f51633 DSN export: export RECT and ARC shapes (on silkscreen layer) from footprints
Also export arc track segments as lines. (Freerouter does not support QARCs)
Fixes #8769
https://gitlab.com/kicad/code/kicad/issues/8769
2021-07-11 18:15:40 +02:00
jean-pierre charras ec64e8ad5b TransformRingToPolygon(): fix incorrect approximation of the hole. 2021-07-06 13:59:05 +02:00
Roberto Fernandez Bautista 72435c78af Fix out of bounds crash in SHAPE_LINE_CHAIN::splitArc
Check that the index references a point that is part of an arc
2021-07-05 20:29:24 +01:00
jean-pierre charras 515669284a convert_basic_shapes_to_polygon: some enhancements:
- allows setting a minimal seg count for circles and rounded end segments.
- When using ERROR_OUTSIDE, ensure the arc correction is the actual value
needed by the segment count, not the max value allowed
2021-07-05 17:46:02 +02:00
Jon Evans 3103ff9aa3 Fix display of filled polygons with arcs in the outline 2021-07-04 12:10:59 -04:00
Jon Evans ddc20dadc0 Formatting and spelling tweaks 2021-07-03 15:43:40 -04:00
Roberto Fernandez Bautista cee5920d5c Remove dead code (SHAPE_LINE_CHAIN::DetectArcs) 2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista 778c64de88 Implement ClearArcs() and check curved polys don't get a booleanOp
We cannot (yet) support passing several curved outlines through clipper.
In these cases, the caller should ClearArcs() before processing.
2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista 260a9d0540 Use ZFillFunction to modify arcs post clipper (does not fully work yet)
Added a unit test to verify union and intersection of polygons result
in desired results: subject + clip - intersect == union
2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista 437e2783fb Use Clipper Z value to detect arcs post clipper 2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista a9a8aa8243 SHAPE_LINE_CHAIN splitArc on Insert, Remove and Replace
This ensures that the arc shapes remain correct after removing
a point belonging to an arc or inserting a point in the middle
of an arc.

Simplify implementation of Replace( ..., aP ). Now a Remove
operation followed by an Insert operation.

Improve QA test for SHAPE_LINE_CHAIN Append, Insert and Replace

Implement SHAPE_LINE_CHAIN::splitArc to break up an arc into two

Implement SHAPE_ARC::ConstructFromStartEndCenter and add qa test
2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista 3f73d8c2b5 SHAPE_LINE_CHAIN::Area() should always be positive
The algorithm relied on the assumption that the points were
ordered anti-clockwise. When ordered in a clockwise fashion, the
result was correct but negative.

Refer to https://www.mathopenref.com/coordpolygonarea2.html
for more information.
2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista c3051ba48a Refactor SHAPE_LINE_CHAIN to allow two shapes per point
m_shapes now has two possible indices. The first one is populated if
the point is associated with an arc and the second index is populated
if the point is shared between two arcs.
2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista c1361ae173 SHAPE_POLY_SET: Detect arcs after boolean operations 2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista 3ee8b4825c Implement SHAPE_LINE_CHAIN::DetectArcs and add qa test 2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista 14c3d9055e Add CIRCLE::Contains( VECTOR2I aP ) and add unit tests 2021-07-03 19:37:50 +00:00
Seth Hillbrand a28d9f17e8 WIP 2021-07-03 19:37:50 +00:00
Seth Hillbrand 8521deb38d De-scope ClipperLib namespace 2021-07-03 19:37:50 +00:00
Seth Hillbrand 6c224156f5 Adding conversion from points to arcs
Allows detection of arcs from segments in a SHAPE_LINE_CHAIN, converting
them to SHAPE_ARCs in the chain
2021-07-03 19:37:50 +00:00
Seth Hillbrand 5b2be906b8 Removing CLIPPER poly support 2021-07-03 19:37:50 +00:00
Seth Hillbrand 4f4deece6d ADDED support for reading/writing arcs in polys
This adds support for reading and writing arc elements in polygons.
2021-07-03 19:37:50 +00:00
Marek Roszko eff75b630f Get rid of anonymous struct typedefs
We are using C++14 where there is no reason for this and is banned in C++20 under P1766R1. MSVC generates a warning under C++14 as a reminder.
2021-07-01 18:28:41 -04:00
Wayne Stambaugh 507a88524a KiCad internal library header file housekeeping. 2021-07-01 13:46:38 -04:00
Wayne Stambaugh 175b474c3e Coverity issue fixes.
Fixes issues #280412, #314755, #329615, #332459, #332157, #332167,
2021-06-30 18:08:49 -04:00
jean-pierre charras 17737af130 Fix some issues related to SHAPE_ARC:
- Some are related to shape errors when the allowed error to approximate circle
by segment is large and arc radius small.
- fix the actual error used in ConvertToPolyline().
- Use SHAPE_ARC::DefaultAccuracyForPCB() instead of a fixed value as extra margin
in zones. It should not change something, because it is also a fixed value
(5 micrometers), but it is not a magic number.
-TransformArcToPolygon() fix some issues and add a new algo, based on the arc actual
outline shape (initial algo is still available in code, just in case).
2021-06-30 13:33:49 +02:00
jean-pierre charras bcb5618315 Fix incorrect calculation in TransformCircleToPolygon(), only noticeable
when the allowed aError is (unusually) large.
2021-06-28 18:51:37 +02:00
jean-pierre charras fa49b54f93 Fix minor issue in TransformCircleToPolygon() when aError is set to a large value.
pcb_painter.cpp: add (but not activate) compil option to show the conversion
of SHAPE_ARC::ConvertToPolyline as segments, for debug purposes.
2021-06-28 15:50:16 +02:00
jean-pierre charras 9a865b1989 Fix a typo and a minor compil warning 2021-06-28 14:37:35 +02:00
jean-pierre charras 310adedf85 Add GetCircleToSegmentError() to geometry/geometry_utils.
This function returns the error created by a circle to segment approximation.
2021-06-26 18:57:07 +02:00
jean-pierre charras 3c81403424 Refinements in Arc to Polygon transform: slightly better shapes of arc ends.
Note also the transform is still not good: the same parameters are applied
to convert inner arc, outer arc and middle arc of a thick arc to segments.
But these parameters depend on arc radius (or circle radius) value.
2021-06-26 14:20:55 +02:00
jean-pierre charras 31d7a0a8d1 TransformArcToPolygon(): slightly better approximation of arc.
The error between the "right" shape and the polygon is slightly smaller.
The approximations of the inner arc and the outer arc are better, but not perfect.
Also add (for test and debug purpose only) the code to show the polygon when
drawing a PCB_ARC (currently disabled)
2021-06-25 18:46:16 +02:00
jean-pierre charras 1d6ad4a52a SHAPE_ARC::ConvertToPolyline(): fix ugly approximation for some arcs.
Arcs with small radius can be approximated with very few segments.
However, if the thickness is large, relative to the radius, the approximation
must be based on the external radius, not the arc radius.
The difference can be significant.
This is especially noticeable for these graphic arcs in filled zones.
2021-06-23 18:30:02 +02:00
Seth Hillbrand a04d6401c1 Transform arcs more accurately
Segment approximation for arcs leaves small "indents" where the rounded
edges of two segments don't quite meet.

This gives closer approximation by calculating the inner and outer joint
points based on the radius, eliminating the indents.
2021-06-11 14:26:38 -07:00
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Marek Roszko ffa87e69c6 Remove/replace some stdint.h includes 2021-06-08 21:17:57 -04:00
Jeff Young 53a75a4961 Fix actual-clearance handling in arc collision routines.
Fixes https://gitlab.com/kicad/code/kicad/issues/8407
2021-06-03 18:33:59 +01:00
Jeff Young 976e756b02 Formatting. 2021-06-03 18:33:59 +01:00
Seth Hillbrand 059f79dfdb Re-remove KiROUND from header
Moves routines requiring KiROUND (and util.h by extension) to the cpp
file
2021-06-03 08:44:17 -07:00
Marek Roszko 29783f125b Eliminate one wxRect constructor in BOX2
The only usage auto converted to BOX2D anyway...
2021-06-03 01:27:15 -04:00
Seth Hillbrand cf1c75ecd4 Handle rounding errors in seg length calculation
SQRT needs to be passed through KiROUND before returning otherwise,
truncation errrors will accumulate between routing and DRC

Fixes https://gitlab.com/kicad/code/kicad/issues/8541
2021-06-02 16:42:35 -07:00
Marek Roszko c294d28275 Split POLY_GRID_PARTITION to a cpp file
Not entirely a lightweight class
2021-06-02 18:31:30 -04:00
Marek Roszko 13abb9f947 Shift some seg functions to the cpp file 2021-06-02 18:31:30 -04:00
jean-pierre charras b6de4da686 Fix compatibility with wxWidgets 3.0.x
Fixes #8533
https://gitlab.com/kicad/code/kicad/issues/8533
2021-06-02 10:02:20 +02:00
Marek Roszko 0b4a680dbb Hotglue wxLogDebug into math/util.h without the global include 2021-06-02 00:26:16 -04:00
Marek Roszko cf2bb5692a Remove the wxLog calls from math/util.h for now
This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
2021-06-01 18:44:22 -04:00
Jeff Young 46d746c9da Performance optimizations. 2021-06-01 23:11:54 +01:00
Tomasz Wlostowski 2d8264124d geometry: SHAPE_LINE_CHAIN::PathLength() now can accept the maximum index of the segment to calculate the length to 2021-05-29 00:13:24 +02:00
Tomasz Wlostowski 7553b7b092 geometry: add minimum distance threshold parameter to SHAPE_LINE_CHAIN::Find()/FindSegment() 2021-05-29 00:13:24 +02:00
Tomasz Wlostowski b3fb7190df geometry: SEG::Contains() should use Distance(), not SquaredDistance() for correct rounding 2021-05-29 00:13:24 +02:00
Tomasz Wlostowski e7fe8c4ddb geometry: rework SHAPE_LINE_CHAIN::Intersect() to explicitly indicate touching vertices and remove references to SEGs from INTERSECTION structure 2021-05-29 00:13:24 +02:00
Jon Evans f30ebbde33 Fix accuracy of tuning path calculation when measuring arcs
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8401
2021-05-10 21:22:51 -04:00
Jon Evans 715c61ac9f PNS: Fix yet more arc edge cases
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8150
2021-04-12 19:59:55 -04:00
Jon Evans 1c431d9929 PNS: Fix some off-by-one errors with arc dragging 2021-04-11 22:12:53 -04:00
Jon Evans f5ef60c2f2 PNS: Fix shoving segment after arc 2021-04-11 18:06:21 -04:00
Jon Evans a26fc6d65d PNS: Fix several issues with arc dragging
Do not merge vertices that belong to different arcs
Fix start segment identification after arcs
Fix free-angle drag after arc

Fixes https://gitlab.com/kicad/code/kicad/-/issues/8173
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8150
2021-04-11 17:56:40 -04:00
jean-pierre charras 258fd07939 Fix a compil issue (at least on msys2) 2021-04-11 17:32:40 +02:00
Jon Evans 7ba110bd77 PNS: Fix dragging of segments with arcs in line 2021-04-11 10:18:57 -04:00
Thomas Pointhuber a30894e5a1 Allow SHAPE_LINE_CHAIN and SHAPE_ARC to be mirrored using a SEG 2021-04-11 13:27:25 +00:00
Jeff Young e04c820442 Formatting. 2021-04-09 14:02:13 +01:00
Roberto Fernandez Bautista b7bd7246af SHAPE_LINE_CHAIN::Split: Add integers before incrementing the iterator
Partially Fixes https://gitlab.com/kicad/code/kicad/-/issues/8131
2021-04-07 11:28:02 +00:00
Roberto Fernandez Bautista 235688e459 Less restrictive Arc Track Dragging tool
Use the connecting straight tracks even if not exactly parallel - allow
an error margin configurable in ADVANCED_CFG (default 1 degree). Also
be less strict about end point matching and use the width of the track
as the criteria to determine suitability.

Finally, delete any short lengths of track at the end of the operation
and amend the arc end points to keep connectivity.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7967
2021-04-06 12:52:01 +00:00
Marcus A. Romer 1632707d9b Replace tabs with spaces 2021-04-05 01:13:39 +00:00
Jon Evans 2c05d99d9f SHAPE_POLY_SET: Fix segment collision testing
It appears as though there was an optimization to skip testing segments if
one of their endpoints (and only the A point) was inside.  Unclear the reason
for this, but I'm going to assume that it was intended to optimize the case
where both points are inside (like the point case above it).
2021-04-04 20:12:45 -04:00
Jon Evans 5bc1e55272 SHAPE_LINE_CHAIN: Don't crash if inserting point at the end 2021-04-04 19:38:54 -04:00
Jon Evans bd6539885b Fix SHAPE_POLY_SET::SquaredDistanceToPolygon ignoring aNearest if unlucky 2021-04-04 19:38:54 -04:00
Jeff Young b6f2941a06 Another try a allowing touching courtyards.
Fixes https://gitlab.com/kicad/code/kicad/issues/8076
2021-03-31 22:54:30 +01:00
Jon Evans f1c599fa4d Tweak PCB selection behavior to reduce unintuitive behavior
We were discarding shapes too aggressively for having a
larger area than a shape underneath.

Let's also try showing fewer disambiguation menus, in particular
always preferring items on the active layer when the candidates
include overlapping items of similar area on other layers.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/7949
2021-03-20 13:11:51 -04:00
Roberto Fernandez Bautista e4b99b9bb5 Fix SHAPE_ARC::Collide and add Unit Tests 2021-03-20 16:11:43 +00:00
Dominik Wernberger e2aa7be4b3 Added a lot of consts and refactored a few lines 2021-03-08 12:49:48 -08:00
Mikolaj Wielgus 0f22b54cd8 Clip the leader lines properly when using circular text frame
Fixes https://gitlab.com/kicad/code/kicad/issues/7810
2021-03-07 21:19:19 +00:00
Tomasz Wlostowski 87ea540953 Fix whitespace errors 2021-02-25 17:18:23 +01:00
Tomasz Wlostowski f7f5e67f56 geometry: SHAPE_LINE_CHAIN::Simplify() now correctly simplifies last 3 colinear vertices 2021-02-25 17:18:23 +01:00
Tomasz Wlostowski baacb9c85a geometry: fix MTV calculation for simple polygons 2021-02-25 17:18:23 +01:00
Jeff Young e89f9db438 Footprint disallow layer checking needs to be based on courtyards.
Fixes https://gitlab.com/kicad/code/kicad/issues/7620
2021-02-20 14:13:36 +00:00
Roberto Fernandez Bautista 2d66abdc89 CADSTAR PCB Archive Importer: More improvements to loading of zones
Adds a new function Area() to SHAPE_POLY_SET
2021-02-10 18:49:21 +00:00
Marek Roszko 872184fe8b Revert "Bump minimum required CMake version to 3.10"
This reverts commit a475f45753.
2021-02-09 18:46:13 -05:00
Simon Richter a475f45753 Bump minimum required CMake version to 3.10
This allows us to remove even more workarounds
2021-02-08 12:23:08 +00:00
Jeff Young 90b3d0c96d Implement TransformShapeWithClearanceToPolygon for DIMENSIONs.
Fixes https://gitlab.com/kicad/code/kicad/issues/6890
2021-02-03 23:34:17 +00:00
Seth Hillbrand 73886aecb1 Ensure partially triangulated polys are not valid
Moves rule area triangulation outside of layer iterator and keeps the
triangulation_valid flag false until the triangulation has been
completed.

Fixes https://gitlab.com/kicad/code/kicad/issues/7032
2021-01-29 16:33:57 -08:00
Wayne Stambaugh 6ab1144ea3 Fix broken Doxygen comment specifiers.
Please note, ///> is not a valid Doxygen comment specifier.  ///< is the
correct specifier to use for single line or short Doxygen comments.
2021-01-25 07:42:36 -05:00
Roberto Fernandez Bautista 99d203feae Clarify CIRCLE::ConstructFromTanTanPt
Remove unused bool aAlternateSolution and add doxygen comments
2021-01-24 16:41:11 +00:00
Roberto Fernandez Bautista 48823c0723 Formatting fixes and fix qa_kimath following rebase 2021-01-24 16:41:10 +00:00
Roberto Fernandez Bautista 19620cebe7 qa tests: fix test_circle 2021-01-24 16:41:10 +00:00
Roberto Fernandez Bautista 6ed5ed52b8 qa tests for CIRCLE geometry library 2021-01-24 16:41:10 +00:00
Roberto Fernandez Bautista b6a50d2f74 qa tests for SEG perpendicularity and parallelism 2021-01-24 16:41:10 +00:00
Roberto Fernandez Bautista 6e7ae93cc8 EDIT_TOOL::DragArcTrack Fix incorrect undo history when items are deleted
Need to make sure we only apply one COMMIT operation per object before calling COMMIT::Push() or COMMIT::Revert()
2021-01-24 16:41:10 +00:00
Roberto Fernandez Bautista 2b5c1bae97 CHANGED: Dragging a curved track starts an interactive resizing of it, keeping start an end points tangent 2021-01-24 16:41:10 +00:00
Seth Hillbrand b8dfcb34c4 Revert "Use less-sophisticated arc editing math."
This reverts commit 3b424d3868.  And fixes
issue with rouding causing arc errors
2021-01-18 12:44:27 -08:00
Mikolaj Wielgus 00a9910149 Fix misplaced parenthesis in VECTOR2<T>::Resize()
Fixes https://gitlab.com/kicad/code/kicad/issues/7045
2021-01-16 09:41:14 +00:00
Dominik Wernberger dc02ec9758 Remove a few const_cast 2021-01-12 20:51:31 +00:00
Dominik Wernberger ac94d72d2d Add more const specifiers 2021-01-12 20:51:31 +00:00
Tomasz Wlostowski 7994c59169 libs/kimath: POLY_GRID_PARTITION must use truncating (round-to-zero) rescale function for correct grid generation. 2021-01-10 00:04:57 +01:00
Seth Hillbrand b2cfd7f479 Fix rounding issues
Rescaling and rotating has been leaving 1nm errors due to integer
truncation in VECTOR2I.  This rounds integers using KiROUND before
returning
2021-01-09 13:05:58 -08:00
Jon Evans 31dd04fa96 Fix ToVector to return world coordinates
Fixes https://gitlab.com/kicad/code/kicad/-/issues/7002
2021-01-08 13:52:39 -05:00
Jon Evans c3eb8dccda Fix typo in DIRECTION_45 ctor 2021-01-07 19:13:05 -05:00
Seth Hillbrand a342bb9ab3 Standardize rounding in 64-bit rescale
32-bit rescale still uses truncation until we can determine how this
affects poly_grid_partition
2021-01-07 11:21:05 -08:00
Seth Hillbrand 77acf85310 Revert "Standardize rescale"
poly_grid_partition appears to depend on integer calculation for large
scaling

This reverts commit eef16fe717.
2021-01-07 10:36:06 -08:00
hoijui 6ca9a42251 Removes 3 other instances of a potential encoding problem
Signed-off-by: hoijui <hoijui.quaero@gmail.com>
2021-01-07 17:36:49 +00:00
hoijui e34b829242 Prevent an encoding error when generating python API DoxyGen
Signed-off-by: hoijui <hoijui.quaero@gmail.com>
2021-01-07 17:36:49 +00:00
Jon Evans 0234b7278a PNS: Make DIRECTION_45 North be up everywhere
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6935
2021-01-06 21:47:06 -05:00
Seth Hillbrand eef16fe717 Standardize rescale
Rescale was returning differing results based on 32-bit vs 64-bit
implementations.  Speed difference here appears to be positive.
2021-01-06 17:52:14 -08:00
Jeff Young 2a088e5c7b Add conversion of circles to zones and enable in footprint editor.
Also rule areas, of course.

Fixes https://gitlab.com/kicad/code/kicad/issues/6966
2021-01-06 17:21:49 +00:00
Jon Evans 7431d5c985 PNS: First pass at updating meander placers for arcs
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6464
2021-01-05 17:57:21 -05:00
Jon Evans 8619086cf2 PNS: re-enable optimization of colinear segs in lines with arcs 2021-01-05 17:57:21 -05:00
Jon Evans 8901e71fc8 PNS: Fix loop removal, make walkaround less broken for arcs 2021-01-05 17:57:21 -05:00
Jon Evans aebb571dc9 Short-circuit arc generation if we are on a diagonal 2021-01-05 17:57:21 -05:00
Seth Hillbrand 5a97764319 Make segment contain its edge
This allows segment snapping along its diagonals to the grid.

Fixes https://gitlab.com/kicad/code/kicad/issues/6924
2021-01-03 12:47:33 -08:00
Jon Evans eaffacbc85 PNS: construct initial lines with arcs more precisely 2021-01-02 23:57:09 -05:00
Jon Evans af4c6393bb Fix arc collisions to account for width
This was causing arcs to be really hard to start routing from
2021-01-02 22:01:05 -05:00
Jon Evans 73248ab219 PNS: correct initial segment direction for posture solver 2020-12-31 13:05:43 -05:00
Jon Evans 111c644a82 Don't append zero-length arcs 2020-12-31 13:05:43 -05:00
Jon Evans fbdf31d35a Prevent creating arcs with slightly offset endpoints 2020-12-31 13:05:43 -05:00
Jon Evans 23c9eddf2d Cleanup 2020-12-30 18:29:41 -05:00
Jon Evans 79502a0d88 PNS: A new approach to arc placement
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6334
2020-12-30 18:23:24 -05:00
Jeff Young af2219ba7f Finish implementation of hole clearance checking.
It appears we never did via hole testing, and pad hole testing didn't
appear to get much testing.
2020-12-25 22:32:19 +00:00
Jon Evans ea351fde69 Recache polygon triangulation when mirroring
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6265
2020-12-20 10:45:24 -05:00
Jeff Young bc484784fc Make sure zones are triangulated for DRC.
Normally this happens as a side-effect of rendering them but if done
from a script (or test case) this won't happen.

Fixes https://gitlab.com/kicad/code/kicad/issues/6635
2020-12-12 15:27:46 +00:00
Jeff Young f08b7f098f Cleanup. 2020-12-12 15:27:46 +00:00
Jeff Young 807eef1208 Better error reporting to try and catch 6635. 2020-12-12 12:22:52 +00:00
Jeff Young 2c2630ef9e Formatting. 2020-12-12 03:43:41 +00:00
Ian McInerney be4b6ec06a Cleanup compiler warnings 2020-12-09 23:13:33 +00:00
Jeff Young 37178e3751 Formatting. 2020-11-29 14:02:46 +00:00
jean-pierre charras 68625494f3 specctra_export: fix an issue with custom and chamfered/round rect pads.
Is some cases a created pad stack name had the same name as an other pad stack
having a slightly different shape, thus creating pads with a incorrect shape on board.

Fixes #6495
https://gitlab.com/kicad/code/kicad/issues/6495
2020-11-25 13:57:46 +01:00
Jeff Young 9c7c05c161 Mostly formatting cleanup but a few type-casting cleanups too. 2020-11-24 22:16:41 +00:00
Marek Roszko 45598f2933 Add handling of DXF arbitrary axis/extrusions
This fixes some DXFs imports where unforunately CAD tools like SolidWorks
randomly decide to mirror circle definitions across the "z" axis (resulting in x or y axis flips in 2d)
Most likely live projection from 3D to 2D drawings introduces this.
However this is DXF specification to describe it so obtusely with vectors for a 2d drawing.
2020-11-23 21:24:38 -05:00
Werni 0e44f5128c Add const specifiers 2020-11-18 19:50:36 +00:00
jean-pierre charras 7265f84358 fix PAD::TransformShapeWithClearanceToPolygon() incorrect calculation in some cases.
For round rect pads, when the arc error was OUTSIDE, the shape was too big and creates
bad shape for chamfered round rect pads.
For chamfered pads, when the clearance value was not 0, the chamfer was not at the
right place.
2020-11-14 08:50:58 +01:00
Jeff Young 63773809d0 Formatting. 2020-11-10 18:08:25 +00:00
Jeff Young 791a50b493 Remove work-around in favour of real fix in Clipper. 2020-11-04 11:21:45 +00:00
Jeff Young 55c25f3cc4 Work around a round-off bug in Clipper.
Fixes https://gitlab.com/kicad/code/kicad/issues/6260
2020-11-02 17:43:13 +00:00
Jeff Young 6bf29deb7f Improve formatting. 2020-10-31 17:25:08 +00:00
Werni a7d5d1f091 Add more consts all over the place 2020-10-27 11:03:35 +00:00
Jeff Young d1c73cb1d5 Clean up MODULE effective shape memory handling. 2020-10-25 23:38:21 +00:00
Jeff Young 31cc100669 Don't make clients deal with nested SHAPE_COMPOUNDs. 2020-10-25 18:17:58 +00:00
jean-pierre charras d6f91c810f Fix a few compil and Coverity warnings. 2020-10-25 10:02:07 +01:00
Jeff Young 59f3fefd17 When polygonizing arcs don't use synthesized center and angle.
Start, mid and end are the "real" properties and come with less
error.

Also collapses two arc polygonization routines into one.

Also fixes DRC checks to be cognizant of arc approximation error.

Fixes https://gitlab.com/kicad/code/kicad/issues/6039
2020-10-23 23:55:45 +01:00
Jeff Young 1cb7fbaab1 Fix errors in arc polygonization and test case.
1) Tests can't expect accuracies around 1 to work.  PCBNew defaults
to 5000.
2) Tests shouldn't artifically expand tolerance just to match the
results.
3) Tests should guarantee that end point is on arc, not just close
to it.
4) Standard polygonization of a circle is inside so splitting the
error needs to increase radius, not decrease.
5) Special-case first and last points so that they're exact.
2020-10-23 23:55:45 +01:00