Commit Graph

149 Commits

Author SHA1 Message Date
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 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 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 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 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
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 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
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00: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
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 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
Thomas Pointhuber a30894e5a1 Allow SHAPE_LINE_CHAIN and SHAPE_ARC to be mirrored using a SEG 2021-04-11 13:27:25 +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
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
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
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
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 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