Commit Graph

100 Commits

Author SHA1 Message Date
Ian McInerney 13b6028e1b Refactor all math into a new kimath library
* Split up the thirdparty code into the thirdparty folder (#3637)
* Create a new kimath static library containing all the math functions

This is part of cleaning the build system for #1906.
2020-01-07 17:12:59 +00:00
Mark Roszko 19ceb11ae7 Change more enums over to scoped enums 2019-12-28 00:55:11 +00:00
Mark Roszko 11ff16be4e Switch to scoped enums 2019-12-20 14:11:39 +00:00
jean-pierre charras 02977aacfc Pcbnew: fix incorrect rotation angle unit when building thermal spokes
The new Rotate function uses radians, not deci-degrees.

Fixes #3668 | https://gitlab.com/kicad/code/kicad/issues/3668
2019-12-13 17:41:20 +01:00
Seth Hillbrand c4d853c1e8 SHAPE_LINE_CHAIN: Remove element access
This is the first step to allowing non-segments in the line chain.
External routines cannot be allowed to change the line chain without
going through the internal routines.  To accomplish this, we remove the
Vertex() and Point() access routines and only leave the const versions.
Transformations are given for both points as well as the chain itself.
2019-12-12 13:54:48 +00:00
jean-pierre charras 4a75cc586c Zone filler: do not create stubs in thermal reliefs when not possible.
pad size is sometimes smaller than the zone minimal width.
So, to avoid strange and incorrect results, do not create the stubs in
thermal relief when the pad size is smaller than the zone minimal width.
2019-12-04 13:23:09 +01:00
Ross Schlaikjer 64a42ffa35 Add keepout in footprints: Starting point. 2019-10-29 11:24:30 +01:00
jean-pierre charras a18d3cca6e Pcbnew, zone filler: Ensure hatch pattern thickness bigger than zone minimal width (one micron bigger).
This margin is mandatory to avoid incorrect polygons in Gerber files:
due to the fact Gerber units can be 10 nm (and Gerbview internal unit is also 10nm), valid polygons
can be converted to non valid (self intersecting for instance) by coordinates truncation.
This is a known problem in Gerber files (not specific to Gerber format)

Fixes: lp:1847737
https://bugs.launchpad.net/kicad/+bug/1847737
2019-10-12 11:12:27 +02:00
jean-pierre charras bd34348068 Pcbnew: allows using filled polygons in zones with no outline thickness.
This option was only available if advanced config "ForceThickZones" was set.
2019-09-06 16:13:41 +02:00
Jeff Young a25368cc6b Improve spelling.
The groundwork here is thanks to kunda1.

Fixes: lp:1831510
* https://bugs.launchpad.net/kicad/+bug/1831510
2019-08-20 19:14:05 +01:00
jean-pierre charras d208447cba Zone filler: clamp thermal stub width to the pad minimal size.
Setting stub width to a ridiculous large value (for instance 100 times the pad size) creates strange and broken shapes,
and obviously stubs cannot be built.
Ensure also the thermal shape is inside the zone boundary (because the algo adds areas this was previously possible)

Fixes: lp:1837559
https://bugs.launchpad.net/kicad/+bug/1837559
2019-07-23 20:32:38 +02:00
jean-pierre charras 164d40f235 Zone filled, non copper zones: fix missing inflate for non stroked solid areas. 2019-07-17 13:24:21 +02:00
Jeff Young 2c5876ee8c Add more control over how corners are handled when inflating polygons. 2019-07-16 16:41:21 +01:00
Jeff Young 6da11de5e0 Be more careful about thermal reliefs for pads on different layers.
Fixes: lp:1605049
* https://bugs.launchpad.net/kicad/+bug/1605049
2019-07-14 23:15:39 +01:00
Jeff Young fe188489c7 A better hack for the post-ProgressReporter-loss-of-focus issue. 2019-07-14 18:18:48 +01:00
Jeff Young 928d6c5dff Implement preserved-corners to prevent divots when filling adjacent zones.
Fixes: lp:1460787
* https://bugs.launchpad.net/kicad/+bug/1460787
2019-07-14 18:18:48 +01:00
Jeff Young 1a7cef2950 Improve performance, commenting and API of some polygon classes. 2019-07-14 10:39:38 +01:00
Jeff Young a3855cb4f2 Allow thermal spokes to be same width as minimum width.
Also some changes for readability and clarity, both in the code
and in the Feature Constraints panel.

Fixes: lp:1835674
* https://bugs.launchpad.net/kicad/+bug/1835674
2019-07-14 10:36:48 +01:00
Jeff Young 2d17d2b91f Cleanup and commenting. 2019-07-14 10:36:48 +01:00
Jeff Young 7ee6afeace Performance improvement for zone filling. 2019-07-06 00:04:54 +01:00
Jeff Young a2fe319b92 Fix bug introduced when edge-thickness adjustments were moved.
Fixes: lp:1835132
* https://bugs.launchpad.net/kicad/+bug/1835132
2019-07-03 12:12:00 +01:00
Seth Hillbrand 743c650129 Move zone refill to action
This unifies the zone refill across architecture into the tool-based
architecture.  Also provides ZONE_FILLER-based progress managment for
tools.

(cherry picked from commit be9cd98cb1)
2019-07-01 09:27:04 -07:00
Jeff Young 00cf8ba976 Fix rotated & offset pad thermal spoke geometry. 2019-06-26 00:04:35 +01:00
Jeff Young 107d206dba Back to the drawing board for zone filling.
This one doesn't cut any corners so should be "correct".  And it
turns out to be pretty fast.
2019-06-25 21:10:21 +01:00
Jeff Young d4054029cd Shrink/expand zone by minimum width only after doing all knockouts.
It's too complicated trying to keep everything smaller or larger by
half the pen width, and some things like spoke-end-detection need the
actual outline anyway.
2019-06-25 11:34:28 +01:00
Jeff Young 3784950603 Added more sophisticated checking for thermal spoke connections.
And, again, some more performance optimizations to make up for it.
2019-06-25 11:34:28 +01:00
Jeff Young 0ed26e4e33 Fix some geometry error in thermal spoke calculations.
Also introduces some performance enhancements to make up for the
extra time spent in the calculations.
2019-06-25 11:34:28 +01:00
Jeff Young e5cb8a0310 Bug fixes for rotated pad thermal spokes. 2019-06-25 11:34:28 +01:00
Jeff Young 70e6d95c7f More zone fill performance enhancements.
Knocking out unconnected spokes turns out to be very expensive, so
keep them in a list and only apply them if they're connected.
2019-06-25 11:34:28 +01:00
Jeff Young 14986d1e0e Zone fill performance enhancements.
Batch up fast operations to reduce the number of slow operations
required.
2019-06-25 11:34:28 +01:00
Jeff Young 79cd457ba7 Implement thermal spokes for custom pad shapes.
The thermal spokes are anchored at the pad anchor.  They may or may
not make sense, depending on the pad shape.  It's up to the author
to move the anchor around as necessary or to not use thermals.
2019-06-25 11:34:28 +01:00
Jeff Young 5c89e4490e Change zone fill algorithm to better handle thermal reliefs.
Thermal reliefs must not knock-out spokes of other pads, while
clearances must knock-out spokes of all pads.  Therefore we now
do all thermal reliefs, then all spokes, then all clearances.

Fixes: lp:602176
* https://bugs.launchpad.net/kicad/+bug/602176

Fixes: lp:1782957
* https://bugs.launchpad.net/kicad/+bug/1782957
2019-06-25 11:34:27 +01:00
Seth Hillbrand 251e0ca19c Minor bug fix to zones
On linux, m_brdOutlinesValid initialized to "true" which prevented
non-copper zones from filling correctly
2019-06-22 10:56:37 -07:00
jean-pierre charras c8c318510e Pcbnew, zones filler: fix a bug I introduced in my commit b1803bc. 2019-06-22 16:41:20 +02:00
jean-pierre charras b1803bcf02 Pcbnew, zones filled: fix incorrect clipping of filled areas outside the board outlines.
fix also an other minor issue: these filled areas were slightly too large.
2019-06-22 09:55:57 +02:00
jean-pierre charras e75be4074e Pcbnew: finalize the new zone filling algo (filled polygons with no thickness). 2019-06-05 18:36:20 +02:00
Seth Hillbrand 9163ac543a pcbnew: Move pads to std::deque 2019-06-01 16:23:54 -07:00
Seth Hillbrand d1877d7c1b Moving modules from DLIST to std::deque 2019-06-01 09:53:23 -07:00
Seth Hillbrand 6bcf1839b7 pcbnew: Add arc approximation setting to board
This places the arc approximation setting in the kicad_pcb file and uses
it for all parts of the board rendering where arcs are converted to
segments.  This allows the user to customize their speed vs. accuracy
tradeoff.  The default setting of maximum error of 0.005mm is acceptable
for small boards on moderate systems.
2019-05-24 21:21:06 -07:00
jean-pierre charras ce93934f08 Pcbnew, ZONE_FILLER: fix incorrect test to remove filled areas outside the board edge cuts.
This incorrect test was only for zones with no net.
2019-05-23 20:22:03 +02:00
Seth Hillbrand ddc6079ceb Move remaining hard-coded segment counts
This removes the remaining hard-coded segments counts and replaces them
with the relative error calculation where the segments per arc is
determined by the maximum error we allow (smaller arcs = fewer segments)
2019-05-16 08:49:55 -07:00
jean-pierre charras 4e5a94efb7 Pcbnew, non copper zones: fix 2 issues.
1 - For debug purposes, the code to fill non copper zones was disabled and the copper zone code was uses instead.
It creates issues with pad clearance areas, because a non copper zone has no clearance areas.
2 - The non copper zone dialog had no option to set the outline smoothing option.
Unfortunately, this parameter was inherited from the last edited copper zone.
And therefore the non copper zone can have a non wanted outline smoothing option.
This option is now added to the dialog.

Fixes: lp:1826952
https://bugs.launchpad.net/kicad/+bug/1826952
2019-04-30 13:16:29 +02:00
Jeff Young dae41b7460 Remove legacy segment-based zones.
Give the user the option of cancelling a file open if there are
segment zones; otherwise they're converted to polygon fills.

Fixes: lp:1823087
* https://bugs.launchpad.net/kicad/+bug/1823087
2019-04-12 20:19:23 +01:00
jean-pierre charras aa53b5508e Zone filler: fix missing calculation of filled polygons when fill mode is ZFM::SEGMENTS 2019-04-10 17:49:40 +02:00
jean-pierre charras 37ae0bf809 Pcbnew: fix a serious issue in ZONE_FILLER. 2019-04-09 11:38:18 +02:00
Jeff Young 52e3a1d7c4 Trim zone fills to board outline.
Fixes: lp:1820306
* https://bugs.launchpad.net/kicad/+bug/1820306
2019-04-08 13:10:29 +01:00
Jeff Young 1ae47b6069 Implement a copper-to-edge-clearance setting.
For legacy boards, the setting is picked up from the board outline
thickness.  If the board outline has mixed thicknesses, then the
max is used and a warning is displayed.

Fixes: lp:1797787
* https://bugs.launchpad.net/kicad/+bug/1797787
2019-04-05 22:18:44 +01:00
jean-pierre charras 7170720f3c Allow hatch pattern in filled zones
the filled areas can use a hatch pattern (crossing lines) using square holes.
The zone filler removes too small holes (truncated holes) from hatch pattern.
It avoid to create small holes when a hole pattern is truncated by the filled area base shape.
2019-03-31 08:21:40 +02:00
jean-pierre charras fdfe5eabfb Fix incorrect detection of filled zones changes in DRC check.
Commit 6006703798 fixed a crash but broke the filled zones changes detection.
Filled zones were always seen as not up to date due to the fact the filled areas were cleared too early.

The up to date detection is also optimized: the old filled polygons are no longer stored.
Instead of, the MD5_HASH is calculated and stored before clearing the filled polygons.
2019-03-21 15:27:05 +01:00
jean-pierre charras 353d9d7c9e Pcbnew, Zone refill: avoid useless refilling, when zone parameters are not modified.
Previously, in many cases the selected zone was refilled on exit selection, even if the zone was not modified.
This is annoying, because the zone fill can be really time consuming, and cannot be called without a good reason.
Now the refilling is made only if a zone parameter is actually modified.
2019-03-14 17:33:25 +01:00