Seth Hillbrand
e8d6d03247
Always return simplified polygons
...
Clipper can handle complex input polygons but we will sometimes struggle
dealing with outputs from the inflate routine that have degenerate or
overlapping points. Calling Simplify after the inflate keeps our
polygons easier to handle
Fixes https://gitlab.com/kicad/code/kicad/issues/11036
(cherry picked from commit a24cdcb3f0
)
2022-03-09 16:19:44 -08:00
Jeff Young
e4b56ab7f1
Performance fixes for the board from hell....
2022-03-08 23:54:34 +00:00
Roberto Fernandez Bautista
d39127cac7
Don't convert arcs with infinite radius - treat them as a line instead
2022-03-07 21:28:43 +00:00
jean-pierre charras
3bee9d3c59
Fix typo
2022-03-07 08:03:48 +01:00
jean-pierre charras
dbfdd3fb56
Fix some Coverity warnings.
2022-03-06 09:48:33 +01:00
Seth Hillbrand
1a7d4f30d9
Fix proper rounding when generating arcs
...
We should allow for KiROUND to find the proper end point of the mid/end
elements when generating an arc from center/start/angle form
2022-03-04 13:14:19 -08:00
Seth Hillbrand
ed7222b1e7
Adds uncertainty propagation to center point calc
...
Since we use center points to move back and forth for angle and
adjustments, we want to ensure that our center point is stable.
Rounding using integers introduces a 0.5 int uncertainty in each
measurement. These are combined together multiple times to calculate
the center point, which combines the uncertainty. Propagating the
uncertainty to the final calculation allows us to assign a range of true
values and pick the value that is most likely the correct value.
Fixes https://gitlab.com/kicad/code/kicad/issues/10739
2022-03-04 11:37:49 -08:00
Seth Hillbrand
3c2eb9311f
Minor optimization for collision checking
...
Prevents extra center point calculations
2022-03-04 11:37:49 -08:00
Jeff Young
b9a834e600
For Coverity.
2022-02-17 16:23:52 +00:00
Jeff Young
c89bb8d0cf
Formatting.
2022-02-17 16:23:52 +00:00
Jeff Young
b1bd8421e0
Performance: remove associated triangle sets when removing outline.
...
This saves us having to re-triangulate at the end of zone filling.
2022-02-16 17:00:54 +00:00
Jeff Young
d8c4f2cb09
Performance improvements for zone filler.
2022-02-15 19:19:02 +00:00
Jeff Young
5c9e718407
Performance enhancements for connectivity.
...
1) Generate SHAPE_POLY_SET triangulation by outline so they can be
shared between connectivity system and other clients.
2) Don't add items to connectivity when reading board; we're going
to do a total rebuild anyway.
3) Use multithreading when caching triangulation.
2022-02-15 12:20:34 +00:00
Jeff Young
98b9c6e2a1
Better progress reporting and a slight performance boost on commit.
2022-02-15 12:20:34 +00:00
Jeff Young
90f6edad61
Move connectivity algo to collision-based routines.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/1800
Fixes https://gitlab.com/kicad/code/kicad/issues/1769
2022-02-13 00:35:11 +00:00
Wayne Stambaugh
e93b7b05ec
Wide characterize libs and bitmap2component source.
...
(cherry picked from commit 54f91a0221
)
2022-02-09 11:49:58 -05:00
Seth Hillbrand
162545ddf0
Validate arc output when editing
...
Handles checking output of the arc to ensure we don't end up generating
an invalid arc. Also keeps the limit of the arc angle to be (360,360)
excluding 0.
Fixes https://gitlab.com/kicad/code/kicad/issues/10070
(cherry picked from commit 8fc831cbc2
)
2022-02-07 08:55:53 -08:00
Marek Roszko
41f54349a5
Replace inserts/push_backs with emplace in some spots
2022-02-05 19:53:31 -05:00
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
08ee2671cc
A better arc-to-polygon algorithm when error is outside.
...
The existing algorithm nicely handled the error being on the inside (where
the segment ends are error-free), but not when it was on the outside (where
the segment midpoints are error-free).
In any case, we want error-free points at each end of the arc so we don't
get ears or divots.
2022-02-02 23:40:24 +00:00
Seth Hillbrand
82ceaf0d9b
Try not to Simplify lines to a single point
2022-01-31 16:13:27 -08:00
jean-pierre charras
0bc5cb33ed
Fix a few issues in plotting code. Fix bug in EDA_ANGLE::IsCardinal()
...
Fixes #10547
https://gitlab.com/kicad/code/kicad/issues/10547
2022-01-21 12:35:58 +01:00
Jeff Young
c8a50d9b50
Remove unit-less angles from VECTOR2I/D APIs.
2022-01-20 23:58:20 +00:00
Jeff Young
14006495d5
Angle cleanup.
2022-01-20 22:35:41 +00:00
Jeff Young
4eac8d7c66
Remove unit-less angles from geometry lib APIs.
2022-01-20 21:10:04 +00:00
Jeff Young
9298da4ebc
ArcToSegmentCount calcs need to use abs value of angle.
2022-01-19 16:01:23 +00:00
Ola Rinta-Koski
ef721f051a
copyright note removed
2022-01-19 15:30:06 +02:00
Jeff Young
2a60017ffa
Fix error in trigo.
...
Fixes https://gitlab.com/kicad/code/kicad/issues/10495
2022-01-19 00:10:32 +00:00
Seth Hillbrand
57afdf153d
Remove unneeded distance calc
...
(cherry picked from commit 857683d372
)
2022-01-18 15:59:16 -08:00
Jeff Young
f310a5b986
Excise deci-degrees from trigo.
2022-01-18 11:44:55 +00:00
Jeff Young
92dae4646e
Yeet dec-degrees from covert_basic_shapes_to_polygon.
2022-01-18 10:14:52 +00:00
Jeff Young
b828355206
A bit more angle cleanup.
2022-01-18 09:48:24 +00:00
Jeff Young
e37ca2f757
Remove dead code.
2022-01-18 01:40:03 +00:00
Jeff Young
8c246a761d
Move EDA_ANGLE from int to double.
2022-01-17 20:57:54 +00:00
Jeff Young
e61144d45a
Finish with EDA_ANGLE.
2022-01-16 21:15:40 +00:00
Jeff Young
e84c574830
Some more EDA_ANGLE cleanup.
2022-01-16 19:16:18 +00:00
Jeff Young
9b661aea10
EDA_ANGLE for plotters.
...
Also fixes a compile error in the PNS Playground.
2022-01-16 01:19:45 +00:00
Jeff Young
1539fa5af2
Move SHAPE_ARC to EDA_ANGLE.
2022-01-16 01:19:45 +00:00
Jeff Young
f3fa7febeb
Fix a degrees / tenths-of-a-degree mismatch.
2022-01-15 11:16:19 +00:00
Seth Hillbrand
22a77d3556
Move EDA_ANGLE to KiMath lib
...
KiMath should only depend on itself not on other elements in the tree
2022-01-14 17:12:24 -08:00
Jeff Young
07013d00e1
More EDA_ANGLE.
2022-01-14 16:08:19 +00:00
Marek Roszko
6d2fd17a39
Remove a wxPoint dependence in trigo
2022-01-04 23:23:36 -05:00
Marek Roszko
e4dbfcd92d
Swap out some wxSize for VECTOR2I
2022-01-04 20:42:27 -05:00
Marek Roszko
ac715d2e51
Scoop up some more wxPoint instances
2022-01-03 20:00:53 -05:00
Marek Roszko
7d671cff1e
Scoop up some more wxPoints
2022-01-01 21:06:40 -05:00
Marek Roszko
589a03afcd
Add std::hash specialization for VECTOR2I
2022-01-01 20:29:08 -05:00
Marek Roszko
8c0da67108
Fix accidentally introduced recursion
2022-01-01 14:39:03 -05:00
Marek Roszko
c91d3e3cf9
Remove some more wxPoint
2022-01-01 14:12:20 -05:00
Marek Roszko
ea613cf448
Another batch of point changes
2022-01-01 13:17:12 -05:00
Marek Roszko
c4c56de708
Neurotically update position wxPoint usages
2022-01-01 11:55:51 -05:00
Marek Roszko
347e03363a
Convert wxPoint/wxSize starting from EDA_RECT usages
2022-01-01 11:30:33 -05:00
Tomasz Wlostowski
78968f75c0
SHAPE_POLY_SET: polysets can now be built from a bunch of arbitraily ordered oriented outlines. Used by the SVG hole support
2021-12-31 17:04:16 +01:00
jean-pierre charras
68f6db7213
Add bezier curve functions to prepare teardrop calculations
2021-12-31 15:54:35 +01:00
Mark Roszko
44dc602d6b
Yeet wxPoint/wxSize out of PLOTTER
2021-12-29 19:02:50 +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
Tomasz Wlostowski
01068e0d41
geometry: fix SHAPE_ARC/SEG collision
...
The arc2segment collision should at also include the arc endpoint projections on the segment being tested. Not sure it covers all possible cases, though.
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/9023
2021-12-09 00:37:58 +01:00
jean-pierre charras
0dad504e91
POLY_GRID_PARTITION: detect a divide by 0, set a wxASSERT and avoid the crash.
2021-12-08 16:07:11 +01:00
Roberto Fernandez Bautista
2d1ad52212
SHAPE_LINE_CHAIN: Fix arc indices rotation after merging duplicate points
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9843
2021-12-05 15:12:09 +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
1026c24c65
SHAPE_LINE_CHAIN fix rotation of indices after going through Clipper
...
Clipper might mess up the rotation of the indices such that an arc can be split between
the end point and wrap around to the start point. Detect if this happened and fix it as
required.
Also, handle arcs at the last segment of the chain correctly, meaning we can have arcs
towards the end of the chain that finish at the starting point of the chain.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9670
2021-11-20 16:47:08 +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
cb7e57fb43
CIRCLE::IntersectLine fix incorrect algorithm documentation comments
2021-11-15 14:04:37 +00:00
Roberto Fernandez Bautista
0c3da0f072
Implement true arc collisions for arcs inside a SHAPE_LINE_CHAIN
2021-11-15 14:04:37 +00:00
Johannes Pfister
64f77b3596
PNS: Add support for 90-degree corner modes
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/6902
2021-11-03 02:14:23 +00:00
jean-pierre charras
29c3601061
SHAPE_POLY_SET: add FullPointCount(), mainly for statistics and debug.
2021-10-24 15:06:24 +02:00
Jeff Young
9b9e379aa0
Overhaul arc internal model to not over-specify information.
2021-10-15 12:45:43 +01:00
Roberto Fernandez Bautista
9e557d84c6
Ensure appended arcs are valid arcs (start, mid, end cannot be collinear)
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9380
2021-10-13 18:58:21 +01:00
Roberto Fernandez Bautista
4b8ca18bf7
Remove unfinished code for handling arcs in SHAPE_POLY_SET::booleanOp
...
Boolean Ops on polygons with arcs are not supported (the only exception
is Simplify)
Also fix a bug in SHAPE_LINE_CHAIN::splitArc that resulted in an
exception
Partially fixes https://gitlab.com/kicad/code/kicad/-/issues/9380
2021-10-13 18:29:32 +01:00
Seth Hillbrand
c1e6fdfb47
Polygon triangulation: Check for broken remainders
...
If the last three points of a tesselation are concave, we will never be
able to triangulate them. They were likely formed from a bad polygon,
so we will drop the triangle and return completed
Fixes https://gitlab.com/kicad/code/kicad/issues/9380
2021-10-12 12:14:42 -07:00
Jeff Young
f606679164
Proper numeric sorting for intersheet refs.
...
Also expunges the horrifically named std::remove and std::remove_if
(neither of which remove anything).
2021-10-01 18:29:21 +01:00
Jon Evans
e2368b733c
Allow selection of NPTH pads with zero copper size
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/9249
2021-09-26 18:17:50 -04: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
Jeff Young
46949abe4a
Don't scroll to highlight an object already visible.
2021-09-25 15:31:52 +01:00
Seth Hillbrand
28bd734313
Prevent invalid paths in fracture
...
We are not always sure of the path validity in fracture. Nominally, the
Clipper Simplify routine should remove invalid parts but in the case
where it doesn't, we need to recover gracefully, even if the output
polygon is not valid.
Fixes https://gitlab.com/kicad/code/kicad/issues/9199
2021-09-21 10:49:39 -07:00
Jeff Young
f64abcba36
Restore BBoxCache usage for zone fill performance.
2021-09-09 16:43:47 +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
ab3564f12d
Fix formatting in prior commit
2021-08-11 17:40:23 +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
11fc74920c
Fix infinite loop in SHAPE_LINE_CHAIN::Slice
...
Was resulting in infinite loop due to wrong calculation
in NextShape.
2021-08-09 21:10:33 +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
1edb96cc5b
Fix SHAPE_LINE_CHAIN::Slice(), splitting arcs when required
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
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