jean-pierre charras
9108404efe
Gerbview: seriously speed up the calculation time to draw polygons on OpenGL.
...
Mainly CacheTriangulation() was creating triangles using partition mode.
But this mode is optimized for Pcbnew and Gerbview and different internal units.
Now CacheTriangulation() is used in no partition, much faster in GERBVIEW_PAINTER.
Fixes #11549
https://gitlab.com/kicad/code/kicad/issues/11549
2022-05-13 18:20:35 +02:00
Wayne Stambaugh
7b2d9dfc0c
Fix some Coverity uninitialized scalar variable issues.
2022-03-24 13:17:07 -04:00
Jeff Young
65185f53a1
Rotate fp zones before comparing with library versions.
...
Also includes some performance fixes to not copy around triangulation
data when it's not needed.
Fixes https://gitlab.com/kicad/code/kicad/issues/10143
2022-03-14 15:53:24 +00:00
Tomasz Wlostowski
2746be30c1
geometry: constructor for SHAPE_RECT from a BOX2
2022-03-03 01:02:00 +01: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
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
dsa-t
68655540eb
Clamp cursor to limits of coordinates representation
...
Also improves large distance handling.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/8846
2022-02-11 16:42:52 +00:00
Mike Williams
a5e8575091
Eeschema: Implement orthogonal dragging
...
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1956
2022-02-10 18:38:40 +00:00
Wayne Stambaugh
e93b7b05ec
Wide characterize libs and bitmap2component source.
...
(cherry picked from commit 54f91a0221
)
2022-02-09 11:49:58 -05: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
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
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
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
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
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
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
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