Commit Graph

65 Commits

Author SHA1 Message Date
Jeff Young 3f8cada334 Fix some issues with new polygonization of arcs and arc collision test.
Test should not be testing against the polygonization error; if done
correctly that should all be on the correct side of the shape.  Use an
epsilon instead (I chose polygonization error / 10, but the value isn't
terribly important).

Fixes https://gitlab.com/kicad/code/kicad/issues/10724
2022-02-03 19:53:42 +00:00
Jeff Young c8a50d9b50 Remove unit-less angles from VECTOR2I/D APIs. 2022-01-20 23:58:20 +00:00
Jeff Young 1539fa5af2 Move SHAPE_ARC to EDA_ANGLE. 2022-01-16 01:19:45 +00:00
Jeff Young 07013d00e1 More EDA_ANGLE. 2022-01-14 16:08:19 +00:00
Roberto Fernandez Bautista 4de4347baa SHAPE_ARC::Collide( aSeg ) must check segment end points as candidates
The edge case is when the segment is completely contained inside the arc
(This partially reverts b4835c8208 and
adds the missing test cases)
2021-12-14 16:14:56 +00:00
Roberto Fernandez Bautista b4835c8208 Add test case for SHAPE_ARC::Collide( seg ) + remove unneeded candidates
Followup to commit 01068e0d41
2021-12-13 18:06:11 +00:00
Roberto Fernandez Bautista c463818b57 SHAPE_LINE_CHAIN: Only fix up arc indices if last pt is part of an arc
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9843
2021-12-03 22:04:55 +00:00
Jon Evans b4342d813b Fix SHAPE_LINE_CHAIN::Slice when end is an arc followed by a point
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9770
2021-11-25 10:05:33 -05:00
Roberto Fernandez Bautista 8f1126bdfc Fix qa test utility GEOM_TEST::IsOutlineValid 2021-11-20 16:44:52 +00:00
Roberto Fernandez Bautista 389cb7d4bc Add SHAPE_LINE_CHAIN tests for arcs with shared points 2021-11-20 16:44:52 +00:00
Roberto Fernandez Bautista 17407b850c Add qa tests for SHAPE_POLY_SET arcs that wrap around from end to start 2021-11-20 16:44:52 +00:00
Roberto Fernandez Bautista 3f60765016 Fix incorrect tolerance applied to CollideArcToPolygonApproximation qa test 2021-11-15 14:04:37 +00:00
Roberto Fernandez Bautista d47bd3a04d Rewrite broken collision routine SHAPE_ARC::Collide( SEG& aSeg ) 2021-11-15 14:04:37 +00:00
Roberto Fernandez Bautista 9b43689a76 Add SHAPE_ARC to SEG collision test cases 2021-11-15 14:04:37 +00:00
Roberto Fernandez Bautista ad3b4f25c2 Add tests for shape_line_chain collision containing arcs 2021-11-15 14:04:37 +00:00
Seth Hillbrand 9a8d1246cc We don't keep a CHANGELOG.TXT
Direct interested readers to AUTHORS.TXT instead.
2021-10-05 19:46:53 -07:00
Roberto Fernandez Bautista 4abee7c2eb Fix SHAPE_LINE_CHAIN::Split when inserting a point on an arc
Ensure the arc is split into two at the point specified.

Partly fixes https://gitlab.com/kicad/code/kicad/-/issues/9023
Additional work required to ensure that the shove state is preserved.
2021-09-26 15:15:51 +01:00
Roberto Fernandez Bautista ed39b33d74 Fix edge case in CIRCLE::Intersect that caused a divide-by-zero crash
Also add some additional test cases.
2021-08-25 19:11:19 +01:00
Jon Evans 80355f04a9 Fix SHAPE_LINE_CHAIN::Replace at end of chain 2021-08-13 16:59:45 -04:00
Roberto Fernandez Bautista d9cf939ba1 SHAPE_LINE_CHAIN::Replace Don't call front() or back() if empty
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8949
2021-08-12 16:32:06 +01:00
Roberto Fernandez Bautista 22df01183d Fix edge cases in CIRCLE::Intersect that were causing KiROUND overflow 2021-08-11 17:31:27 +01:00
Roberto Fernandez Bautista ae87dc686a Fix SHAPE_LINE_CHAIN::NearestPoint when aAllowInternalShapePoints=false
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8770
2021-08-08 20:58:20 +01:00
Roberto Fernandez Bautista fb3a6ef2db Add qa Test for SHAPE_LINE_CHAIN::Slice 2021-08-08 19:09:54 +01:00
Roberto Fernandez Bautista eaf8eb284a Add true arc-to-polyline collisions 2021-08-05 17:45:12 +01:00
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
Roberto Fernandez Bautista f2925dc6cb Added a few more test cases 2021-08-05 17:45:11 +01: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 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 2f069c0b19 Add test for detecting arcs post clipper 2021-07-03 19:37:50 +00:00
Roberto Fernandez Bautista e54a44e1d3 Add qa test for SHAPE_POLY_SET::Simplify() 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
luz paz f968fc8719 Fix source comment / documentation typos 2021-06-09 19:32:58 +00:00
Seth Hillbrand de89505f02 Fix QA for rounding segments 2021-06-03 10:18:50 -07:00
Sylwester Kocjan 31da3e7dc6 qa: merge unit_test_utils to qa_utils 2021-05-19 11:02:52 +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
Roberto Fernandez Bautista e4b99b9bb5 Fix SHAPE_ARC::Collide and add Unit Tests 2021-03-20 16:11:43 +00: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
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
Wayne Stambaugh 4ea3914d4e Coverity fixes.
CIDs: 312996, 305508, 305509, 305510, 312992, 312997, 312994, 312995,
312968, and 306650.
2020-11-10 08:50:16 -05: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