Commit Graph

157 Commits

Author SHA1 Message Date
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 f8f1476f63 Performance enhancement for Fracture(). 2019-06-25 11:34:28 +01:00
Jeff Young 1099befab1 Performance improvement for SHAPE_LINE_CHANGE::PointInside().
It was calculating the bounding box twice (and failing to honour
the accuracy parameter on the bounding box test).

Worse, constructing the bounding box is about the same speed as
the rigorous test, so it never improves things.
2019-06-25 11:34:28 +01:00
Tomasz Włostowski 6180687bbd TestSegmentHit: add corner case for null segment (start == end)
Fixes: lp:1833059
* https://bugs.launchpad.net/kicad/+bug/1833059
2019-06-25 01:06:25 +02:00
jean-pierre charras b7f4113f96 Some minor fixes to prepare the new zone filling algo (no filled polygon thickness) 2019-06-02 11:51:47 +02:00
Jon Evans e156e4509c Report actual intersection position for crossing tracks
Fixes: lp:1825588
* https://bugs.launchpad.net/kicad/+bug/1825588

(cherry picked from commit f101934909)
2019-05-26 13:03:23 -04:00
Seth Hillbrand 490c805319 Allow squared inflation and inflate Eagle Zones
Sometimes we want to inflate a polygon without adding rounded edges.
This add the option using the jtMiter setting.

This is used in the Eagle parser to expand the Eagle zones for KiCad.
Eagle Zones are drawn on the polygon edge, so they extend out from the
outline.  KiCad zones are drawn inside the polygon.  We need to both
increase the zone size and decrease the minimum pen width to account for
this.

Fixes: lp:1817312
* https://bugs.launchpad.net/kicad/+bug/1817312
2019-05-21 13:49:18 -07: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 a155289f70 Custom pads: fix incorrect shape of masks when the shape is a polygon with holes and the mask margin is < 0.
This is mainly the solder paste layer that shows this issue.
This is due to the fact SHAPE_POLY_SET::Inflate does not work fine with polygons with linked holes.
SHAPE_POLY_SET::InflateWithLinkedHoles it added to fix this issue.

Fixes: lp:1828287
https://bugs.launchpad.net/kicad/+bug/1828287
2019-05-09 16:23:18 +02:00
Jeff Young fd546da640 Homogenize hit testing and selection return types.
Prep work for sharing SCH_SELECTION_TOOL with LibEdit.
2019-05-05 17:14:30 +01:00
John Beard d89d0e6b74 SHAPE_ARC: Fix bug introduced in 5813164d1.
This fixes the bug exposed in the previous commit.
The tests which exposed it now pass and expected failures
removed.
2019-04-25 23:49:42 +01:00
Tomasz Włostowski 5813164d15 SHAPE_ARC: fixed polyline conversion bug introduced in e312e2b286
Fixes: lp:1826278
* https://bugs.launchpad.net/kicad/+bug/1826278

Fixes: lp:1826270
* https://bugs.launchpad.net/kicad/+bug/1826270
2019-04-25 15:30:27 +02:00
John Beard e312e2b286 SHAPE_ARC: fix polyline conversion when radius=0
Prevent a divide-by-zero bug in SHAPE_ARC::ConvertToPolyline.

When the radius is zero, just use the initial angle (it makes
no different anyway, the result is the centre point, which is
the start point.
2019-04-17 10:52:56 +01:00
Seth Hillbrand 24bf838392 pcbnew: Allow arc editing via midpoint
This permits changing the radius of the arc by adjusting the center
point of the arc.  The arc end points are fixed in this operation.
2019-04-07 06:50:25 -07:00
jean-pierre charras 0d2dd48cad geometry/geometry_utils.cpp: Fix a minimal value (6) to calculate the segments by circle count to approximate a circle.
Use also this minimal value to calculate  the circle to poly correction factor
Also, remove a useless code.
2019-04-02 11:33:35 +02:00
Tomasz Włostowski 313ebb9dff router: correct walkaround corner case when both ends of the line lie on the hull edge
Fixes: lp:1810935
* https://bugs.launchpad.net/kicad/+bug/1810935
2019-02-03 11:22:18 +01:00
Tomasz Włostowski 7d544d1ffe geometry: rewrite SHAPE_LINE_CHAIN::PointInside() to use fixed point arithmetic and support non-convex outlines. Fixes both P&S misbehaviours and zone filling/QA issues 2019-01-30 01:08:57 +01:00
Seth Hillbrand 93ecd44f5a Revert "geometry: revert SHAPE_LINE_CHAIN::PointInside/PointOnEdge() optimizations so that it's consistent with other collision checking methods (i.e. SEG::Distance() )"
This reverts commit 4a0fba309a.
2019-01-29 13:36:17 -08:00
Tomasz Włostowski 4a0fba309a geometry: revert SHAPE_LINE_CHAIN::PointInside/PointOnEdge() optimizations so that it's consistent with other collision checking methods (i.e. SEG::Distance() )
Fixes: lp:1810935
* https://bugs.launchpad.net/kicad/+bug/1810935
2019-01-28 13:24:41 +01:00
jean-pierre charras 90178eb681 Optimize DRC calculation for copper texts. fix also a bug in SHAPE_POLY_SET::Distance( const SEG& aSegment, int aSegmentWidth ).
This bug calculate incorrectly the distance between aSegment and the SHAPE_POLY_SET for the first segment of the SHAPE_POLY_SET.
2019-01-26 13:01:48 +01:00
Seth Hillbrand 4a68ae4bae polygon: Fix missing steiner removal and fracture
When removing steiner points, there is the possibility that the test
point is also removed.  In this case, it is no longer a member of the
linked list and will break the output.

The test for re-fracturing a broken polygon can also result in multiple
polygons, rather than only 0 or 1.  Skipping the extra polygons will
result in a limited tesselation.

Fixes: lp:1812393
* https://bugs.launchpad.net/kicad/+bug/1812393
2019-01-18 09:19:39 -08:00
John Beard d6f4f3aca0 Geom: Account for quadrant points in arc bbox calc
This means arcs that pass though quadrant points (multiple of
0, 90, 180, 270 degrees) include these points in the bbox.
2019-01-10 07:52:25 -05:00
Seth Hillbrand 64f1fb9e79 tesselation: Re-check polygon count after fracturing
The fracture() call may result in zero polygons remaining, which will
cause failure in our tesselation routine, so we need to check whether
this is a valid POLYGON before re-tesselating.
2018-12-18 13:49:13 -08:00
Seth Hillbrand 2498da2745 Tesselation: Only set valid when successful
Tesselation can fail for a number of reasons.  When this happens, we set
the triangulationValid flag to false to prevent using the broken
triangulation.  This will fall back to the slow OpenGL triangulation
when DrawPolygon is called.
2018-12-18 09:16:16 -08:00
jean-pierre charras 388397f97d Protect TesselatePolygon() against degenerated polygons (less than 3 corners) to avoid crashes.
Use TesselatePolygon() to draw polygons in Gerbview instead of GLU tesselation, much slower.
Add helper methods in GAL to know if the current GAL engine is Cairo, OpenGL or something else,
useful to optimize drawing code.
2018-12-18 12:49:14 +01:00
Seth Hillbrand 657bf2b53e tesselation: In case of failure, re-fracture
Simplification with clipper can produce a polygon with holes.  We need
to re-call simplify followed by fracture to ensure valid triangulation
2018-12-17 17:02:32 -08:00
Seth Hillbrand 26765161c1 drc: Add board outline and edge crossing
This adds a check for contiguous board outlines to the DRC.  It also
uses the calculated outline to ensure that traces are not crossing the
outlines.

Fixes: lp:1648055
* https://bugs.launchpad.net/kicad/+bug/1648055
2018-12-02 07:54:52 -08:00
Jeff Young fee52e127f Add line style drawing. 2018-10-09 11:08:56 +01:00
Tomasz Wlostowski b604f007d7 eeschema-gal: don't use kiROUND in the geometry library as it brings in a s*****load of wx dependencies due to #include <base_units.h> 2018-10-09 11:08:55 +01:00
Jeff Young 5974899fa5 Clean up file locations and names. 2018-09-22 16:23:13 +01:00
Seth Hillbrand f8784f30a8 Removing OpenMP
This commit finishes the removal of OpenMP from the KiCad codebase.
Removed in this commit are the OpenMP calls in 3d-viewer and
qa/polygon_triangulation as well as all references in CMakeLists.txt

std::thread is used instead for multithreaded computation
2018-09-21 12:44:20 -07:00
Seth Hillbrand 3ebba6cbe1 pcbnew: Limit zone simplification
Commit 73c229714 was a bit of a sledgehammer for the associated problem
of degenerate points.  This commit replaces that one by only performing
additional simplification of the zone polygons on those polygons that
fail our initial triangulation attempt.
2018-09-12 15:28:13 -07:00
Seth Hillbrand 73c2297144 triangulation: Fracture/Simplify all polygons
Calls the simplify/fracture polygon code on any polygon prior to
tesselation.  This avoids issues with degenerate polygons where the
degenerate points are not sequential.

Fixes: lp:1790534
* https://bugs.launchpad.net/kicad/+bug/1790534
2018-09-05 15:11:13 -07:00
Seth Hillbrand a6325aab29 Replacing Tesselation
Replaces Poly2Tri with updated code to process polygons faster and more
robustly.  Notably, we can now handle overlapping holes in the polygons,
allowing us to cache the triangulation of complex boards
2018-09-01 19:30:50 -07:00
Jeff Young 7c04d8be1c Double opening speed of PCBs with ground and/or power planes.
(Or any other boards with complicated zones.)
2018-08-07 17:01:44 +01:00
Jeff Young 72338a7002 Remove more dead code. 2018-08-01 12:36:55 +01:00
Jeff Young 6dbfa793e8 Fix GTK compile errors and remove dead code.
Fixes: lp:1783993
* https://bugs.launchpad.net/kicad/+bug/1783993
2018-08-01 12:23:16 +01:00
Seth Hillbrand 840ad7f680 Add SH_ARC collisions 2018-07-17 10:08:13 -07:00
Maciej Suminski 1751e4631c Code formatting 2018-06-23 01:59:49 +02:00
jean-pierre charras 6e5131be5a Minor fix in fp editor and fp viewer: display the fp info instead of the useless board info.
board info makes sense only in board editor, not in fp editor and fp viewer.
2018-05-12 10:44:31 +02:00
Seth Hillbrand 6a726ca299 Unify polygon point checks
Mutliple checks are made for point in polygons/closed line chains.  This
unifies the checks to a single (hopefully) place for improved debugging.
2018-05-11 15:42:41 -07:00
Seth Hillbrand f2aea97807 Calculate inside polygon using points
Minor improvement in polygon calculation to use consecutive points
rather than casting to a full segment.  Avoids division except when it
will not create a denormal.
2018-05-11 15:42:41 -07:00
Seth Hillbrand d67821d771 Add a clearance check for closed shape line chains
Also improves speed of multiple point checks by first eliminating points
outside of the BBox.
2018-05-11 15:42:41 -07:00
Seth Hillbrand b2c4519c2c Setting custom pad shape to be outline for PNS
Changes SHAPE_CONVEX to SHAPE_SIMPLE to better reflect the limitations.
Changes SHAPE_LINE_CHAIN::PointInside calculation to allow points
strictly inside a line chain

Fixes: lp:1768862
* https://bugs.launchpad.net/kicad/+bug/1768862
2018-05-04 08:23:20 -07:00
Seth Hillbrand 2a87117edc Speed load/unload of complex boards
Corrects an error in polyline estimation

Syncs graphics to world PNS by whole layer set rather than
individual layer at a time.

Prevents reloading of full pns TOOL_BASE during reset of tools unless
the tool is being activated.

Fixes: lp:1766626
* https://bugs.launchpad.net/kicad/+bug/1766626
2018-04-28 16:11:07 +02:00
Seth Hillbrand bd5eee50f4 Unify correction factor calculations 2018-04-23 16:43:13 -07:00
Seth Hillbrand dbfa9093ab Adding seg-polyset collision support 2018-04-23 16:43:13 -07:00
Seth Hillbrand b618da1fac Fixing bounding box calc for arcs 2018-04-23 16:43:13 -07:00
Jeff Young d54a252eaa Check zone fills for being out-of-date during DRC. 2018-04-09 11:05:14 +01:00