Commit Graph

159 Commits

Author SHA1 Message Date
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 4eac8d7c66 Remove unit-less angles from geometry lib APIs. 2022-01-20 21:10:04 +00:00
Jeff Young 854987f663 Remove unit-less angles from geometry manager APIs. 2022-01-20 21:10:04 +00:00
Jeff Young af20d46d06 Fix converting angles from tenths of a degree.
(Conversion was upside-down.)

Also fixes bugs with rotation angle increment not getting units
set and with a 0 footprint editor value overwriting a non-zero
pcb editor value (or vice versa).
2022-01-19 19:55:50 +00:00
Ola Rinta-Koski ef721f051a copyright note removed 2022-01-19 15:30:06 +02:00
Jeff Young b828355206 A bit more angle cleanup. 2022-01-18 09:48:24 +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 1539fa5af2 Move SHAPE_ARC to EDA_ANGLE. 2022-01-16 01:19:45 +00:00
Jeff Young 3f98769a77 More EDA_ANGLE.
Includes bug fix for catastrophic error in Add() for converting to
radians.

Includes bug fixes for the fact that the pcbnew test can't seem to
find the ANGLE_* objects (getting all 0's instead).
2022-01-15 01:30:04 +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 fcfe42d67c Continue the war on wxPoint 2022-01-10 19:52:26 -05:00
Jeff Young 27c967421c Commenting and "auto" reduction. 2022-01-08 16:47:45 +00:00
Marek Roszko ea613cf448 Another batch of point changes 2022-01-01 13:17:12 -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
Jeff Young 2bc86fa0a8 Shapes for schematic.
ADDED arc, circle and rectangle shapes for schematic.  Shapes support
line styles and fill colors.

CHANGED sheet background color in Edit Text & Graphics Properties to
fill color (and it now affects shapes).

Pushed STROKE_PARAMS down into common and moved all shapes to using it
for stroke descriptions.
2021-12-23 20:36:07 +00:00
Jeff Young d5a5928e5a Improve clean up tracks & vias algorithm for neck-downs.
Fixes https://gitlab.com/kicad/code/kicad/issues/10098
2021-12-23 16:54:03 +00:00
Jon Evans 0570c22732 Use point collision test for zero-length segments
SEG::SquaredDistance( SEG& ) does not do the right thing
for segments with zero length at the moment.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/9791
2021-11-27 09:08:34 -05:00
Tomasz Wlostowski 5d2f3257da libs/kimath: user-settable distance threshold for SEG::ApproxParallel() 2021-11-22 01:35:12 +01: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 0c3da0f072 Implement true arc collisions for arcs inside a SHAPE_LINE_CHAIN 2021-11-15 14:04:37 +00:00
Jeff Young d66487c383 Make sure RTree bounding box is at least as big as hole.
Fixes https://gitlab.com/kicad/code/kicad/issues/9526
2021-11-05 14:29:10 +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
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
Seth Hillbrand 52bbfb9109 Remove dependency of dot size on linear mils
Changes a dot to be a square pixel (linewidth x linewidth).  This allows
the removal of IU dependencies and ensures that a dot is always visible
on screen.  Also makes sure that cairo is setting the current linewidth
during its stroke routines

Fixes https://gitlab.com/kicad/code/kicad/issues/9362
2021-10-10 09:40:26 -07:00
Jeff Young 46949abe4a Don't scroll to highlight an object already visible. 2021-09-25 15:31:52 +01:00
Jeff Young f64abcba36 Restore BBoxCache usage for zone fill performance. 2021-09-09 16:43:47 +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 1edb96cc5b Fix SHAPE_LINE_CHAIN::Slice(), splitting arcs when required 2021-08-08 19:09:54 +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 318435aedb Add more test cases: simulate zone fill around arc + diff pair meander 2021-08-05 17:45:11 +01: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
Wayne Stambaugh 4c457b5ed3 More NULL expunging. 2021-07-18 14:31:55 -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 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