Commit Graph

169 Commits

Author SHA1 Message Date
Marek Roszko 84fbb0e382 Remove some includes in random pcbnew files 2020-10-14 20:47:48 -04:00
Jeff Young bbe7573d1c Performance enhancements to roundrect pads and clearance outlines.
Aka: avoid Clipper at all costs.

Fixes https://gitlab.com/kicad/code/kicad/issues/5900
2020-10-14 15:56:43 +01:00
Jeff Young 1703729269 Require explicit decl of maxError and errorLocations.
This should reduce both performance issues and clearance issues.
2020-10-13 13:49:07 +01:00
Jeff Young 37906511f5 Class renaming.
DRAWSEGMENT  -> PCB_SHAPE
EDGE_MODULE  -> FP_SHAPE
TEXTE_PCB    -> PCB_TEXT
TEXTE_MODULE -> FP_TEXT
2020-10-05 11:55:33 +01:00
Jeff Young 7a4900b8dc PCB_LINE_T -> PCB_SHAPE_T and PCB_MODULE_EDGE_T -> PCB_FP_SHAPE_T
Also updated footprint text and zone types for consistencey.
2020-10-04 16:49:04 +01:00
jean-pierre charras 87a220b8e2 more cleanup about removing useless include 2020-10-02 14:51:11 +02:00
Seth Hillbrand bf3cb0b1d0 Standardize pad type enums 2020-09-30 08:38:35 -07:00
Jeff Young d3f8f2b81e Remove confusion between pad->IsOnLayer and pad->IsPadOnLayer 2020-09-30 11:50:51 +01:00
Jeff Young 7e5a6371c1 Cleanup. 2020-09-23 01:14:35 +01:00
Jeff Young 4badcba4c2 Zone fill performance improvements
1) better load-balancing for deferred zones
2) sort zones by priority before filling
3) retire BOARD::GetZoneList() which had a horrible performance profile
4) implement a zone bounding box cache
5) better checks for IsCancelled() so long fills can be exited

Fixes https://gitlab.com/kicad/code/kicad/issues/5738
2020-09-21 21:09:58 +01:00
Jeff Young e2bc7557cc Clean up arc/circle polygonization.
1) For a while now we've been using a calculated seg count from a given
maxError, and a correction factor to push the radius out so that all
the error is outside the arc/circle.  However, the second calculation
(which pre-dates the first) is pretty much just the inverse of the first
(and yields nothing more than maxError back). This is particularly
sub-optimal given the cost of trig functions.

2) There are a lot of old optimizations to reduce segcounts in certain
situations, someting that our error-based calculation compensates for
 anyway.  (Smaller radii need fewer segments to meet the maxError
condition.) But perhaps more importantly we now surface maxError in the
UI and we don't really want to call it "Max deviation except when it's
not".

3) We were also clamping the segCount twice: once in the calculation
routine and once in most of it's callers.  Furthermore, the caller
clamping was inconsistent (both in being done and in the clamping
value). We now clamp only in the calculation routine.

4) There's no reason to use the correction factors in the 3Dviewer;
it's just a visualization and whether the polygonization error is
inside or outside the shape isn't really material.

5) The arc-correction-disabling stuff (used for solder mask layer) was
somewhat fragile in that it depended on the caller to turn it back on
afterwards.  It's now only exposed as a RAII object which  automatically
cleans up when it goes out of scope.

6) There were also bugs in a couple of the polygonization routines where
we'd accumulate round-off error in adding up the segments and end up with
an overly long last segment (which of course would voilate the error
max). This was the cause of the linked bug and also some issues with vias
that we had fudged in the past with extra clearance.

Fixes https://gitlab.com/kicad/code/kicad/issues/5567
2020-09-11 11:23:49 +01:00
Mario Luzeiro 1ab968e72f 3D-Viewer: render different materials plated and non plated copper
implement on OpenGL
2020-09-08 21:02:19 +00:00
qu1ck 636285311e Make DRAWSEGMENT::GetRectCorners return vector
... instead of modifying the argument.
This will make the method usable in python API and will not incur
permormance penalty because named return value optimization (NRVO)
is a thing since C++11.
But even if copy is not elided vector is moved instead of copied.
https://en.cppreference.com/w/cpp/language/copy_elision
2020-09-07 05:33:10 +00:00
Jeff Young 56a531109a Don't try and shrink shapes generated from pads.
It ends up being different from shrinking the final outline.
2020-08-28 20:48:47 +01:00
Jeff Young ebb9a636fa Handle differential x:y clearance for solder mask.
Fixes https://gitlab.com/kicad/code/kicad/issues/5363
2020-08-28 14:00:37 +01:00
Jeff Young 9e12ea9bb6 Cleanup some dead code and make better use of iterators.
Also applies coding style around auto and lambdas.
2020-08-28 11:05:58 +01:00
Jeff Young 4410df50a8 Remove layer check that prevents synthetic layer drawing.
In this particular case it was LAYER_PAD_FR.

Fixes https://gitlab.com/kicad/code/kicad/issues/5190
2020-08-15 17:32:13 +01:00
Jeff Young 393bb0fd83 Fix assert where geometry routine wasn't ready to handle layers.
This introduces layer handling to a lot of the geometry routines.
Many of them don't do much with it now, but it does help multi-layer
zones and will help when padstacks are implemented.
2020-08-12 22:20:08 +01:00
Jeff Young 463100d67f Remove a long-standing hack to keep divots out of adjacent zones.
The new algorithm unions any adjacent zones before doing the
chamfer/fillet and then subtracts the other zones back out afterwards.

Fixes https://gitlab.com/kicad/code/kicad/issues/3812
2020-08-12 22:20:08 +01:00
jean-pierre charras eae739d98e ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(): for polygons with outline
thickness, use another algo to create shapes mainly used in 3D viewer.
For the 3D viewer, the calculation time to build zones is significantly faster.
2020-08-12 10:13:54 +02:00
jean-pierre charras 9c817638d9 ZONE_CONTAINER::TransformSolidAreasShapesToPolygonSet(): fix incorrect transform
For zones filled using the new algo (filled areas without thickness), a outline
with thickness was added, that is incorrect.
Used only in 3D viewer.
2020-08-11 11:49:08 +02:00
jean-pierre charras 29d6fe88f0 3D viewer: do not show via/pad shapes of pads not connected on copper layers.
Show the same vias/pad shapes as plot functions.
2020-08-11 11:26:00 +02:00
Seth Hillbrand 370bc89d5a Lowercasing private variables in class_pad 2020-08-10 03:27:27 +00:00
jean-pierre charras 4cf5662ea1 Fix incorrect shape of trapezoidal pad shapes. They were not the same as stable branch. 2020-07-31 14:37:21 +02:00
Jeff Young d85a707385 Move rest of DRC to SHAPE collision architecture. 2020-07-06 20:00:50 +01:00
jean-pierre charras 82da739786 Better calculations in TransformRoundChamferedRectToPolygon().
the old calculations was creating a slightly too small shape for rounded corners.

Now the polygon is outside the perfect shape (as required to create a shape with clearance)

Fixes #4805
https://gitlab.com/kicad/code/kicad/issues/4805
2020-07-05 19:32:07 +02:00
Jeff Young 441dfa30f0 Return individual custom pad shapes instead of a SHAPE_POLY_SET.
Also implements an optional pointer to return the actual distance
from all the SHAPE collision routines.

Fixes https://gitlab.com/kicad/code/kicad/issues/4774
2020-07-02 17:09:15 +01:00
Jeff Young 40a72d9530 Add SH_RECT handling to 3D shape conversion.
Also add some debugging for not-implemented shape cases in other
places to catch simmilar issues in future.

Fixes https://gitlab.com/kicad/code/kicad/issues/4757
2020-06-30 18:32:31 +01:00
jean-pierre charras a229e51962 Pcbnew: fix incorrect clearance of oval pads in zone fill.
(The clearance value was only half of the correct value)
2020-06-29 09:57:36 +02:00
Jon Evans 0d4ee39f75 CHANGED: Copper zones can be on more than one layer
Fixes https://gitlab.com/kicad/code/kicad/-/issues/1963
2020-06-28 08:52:37 -04:00
Jeff Young da2b7071b4 WYSISYG custom pad editor.
Fixes https://gitlab.com/kicad/code/kicad/issues/2153

Fixes https://gitlab.com/kicad/code/kicad/issues/2305
2020-06-27 14:37:01 +01:00
Jeff Young d01b29ab37 Cleanup pad geometry handling.
There were a lot of plotters, exporters, etc. that were rolling their
own implementations.

This also introduces a lazily-built set of SHAPE objects for doing
collision detection and some forms of rendering (and later DRC).
2020-06-22 22:28:37 +01:00
Jeff Young 986c1a27cd Make sure line widths (and clearances) are handled on rectangles. 2020-06-20 14:34:53 +01:00
Jeff Young aeed8e6e2c Finish implementation of DRAWSEGMENT::C_RECT.
It's currently only supported in the Footprint Editor.  It could be
easily added to the board editor (all the code is there), but the board
editor is a little short on room in the drawing tools toolbar.
2020-06-15 20:51:31 +01:00
Jeff Young 874f13e29e Fix some issues with rotated oval pads. 2020-05-01 18:49:42 +01:00
Jeff Young 2b6089240a Change super/subscript syntax to ^{foo} and _{foo}. 2020-04-18 21:04:41 +01:00
Jeff Young 9c8941e040 Remove a bunch of globals. 2020-04-16 17:34:46 +01:00
Jeff Young 6e800bddae Rationalize penWidth processing as first step in removing some globals. 2020-04-13 20:58:13 +01:00
jean-pierre charras 2c8ada42a0 Arc shaped track segments: fix 3D viewer and track to polygon converter. 2020-04-09 10:37:17 +02:00
Jeff Young 2e509480a4 Fix guaranteed divide-by-zero error when called with correction of 0. 2020-01-11 21:29:25 +00:00
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
Seth Hillbrand 9c8ae217a6 pcbnew: Treat circular ovals as circles
The oval clearance adds an edge on the 0-length side of a circular oval.
This is not needed and can affect the fill algorithm.  Instead, we treat
round ovals as circles for pad polygons

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

(cherry picked from commit 57f0f88552)
2019-10-25 09:37:43 -07:00
Jeff Young 8dd8740fa3 Performance enhancement for pad drawing.
Fixes: lp:1843065
* https://bugs.launchpad.net/kicad/+bug/1843065
2019-09-09 13:45:06 +01:00
Jeff Young e1d5cf1a87 Change pad solder masks to use rounded-corner clearances.
This assumes maximum registration errors are a vector, rather than
an amount in both x and y axes.  Lots more disucssion in the bug
report and on the forum (link in the bug report).

Also makes large changes to the painting of pads, but they now use
the same code as plotting, so if there are any changes then they
were errors before since plotting represents "truth".

Fixes: lp:1563744
* https://bugs.launchpad.net/kicad/+bug/1563744
2019-06-25 11:34:27 +01:00
jean-pierre charras 8085899d0a Pcbnew: better approximation of arcs by polygons for pads having a very small size.
Especially, small round rect pads have a ugly shape because the number of segments is
small and the 90 deg arcs are not very well approximated.
The minimal seg count for 90 deg arcs is now 4 (16 segm/circle) for pads.

Fixes: lp:1833005
https://bugs.launchpad.net/kicad/+bug/1833005
2019-06-17 17:26:15 +02:00
Seth Hillbrand 37afcd93e2 pcbnew: Fix missing correction to Pad->Polygon transform
The rounded radius needs to be corrected even when there is no clearance
to ensure that the pad segments fall on the arc.
2019-06-17 05:28:52 -07:00
Jeff Young 6fab7cc025 Remove a bunch of ugly mutex hacks now that we don't use wxString's UTF8 mode anymore. 2019-06-05 21:23:41 +01:00
Seth Hillbrand 6a45446496 pcbnew: Remove the last dlist from modules/pcbnew 2019-06-01 20:55:32 -07:00
Seth Hillbrand 9163ac543a pcbnew: Move pads to std::deque 2019-06-01 16:23:54 -07:00
Seth Hillbrand 888c01d11b pcbnew: Move tracks to std::deque 2019-06-01 09:53:23 -07:00