kicad/libs/kimath/include/geometry
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
..
convex_hull.h Refactor all math into a new kimath library 2020-01-07 17:12:59 +00:00
direction45.h pcbnew: Adding arcs to PNS 2020-02-21 16:11:41 -08:00
geometry_utils.h Clean up arc/circle polygonization. 2020-09-11 11:23:49 +01:00
poly_grid_partition.h Comment-only changes 2020-01-10 16:43:01 -08:00
polygon_test_point_inside.h Refactor all math into a new kimath library 2020-01-07 17:12:59 +00:00
polygon_triangulation.h Refactor all math into a new kimath library 2020-01-07 17:12:59 +00:00
seg.h Return individual custom pad shapes instead of a SHAPE_POLY_SET. 2020-07-02 17:09:15 +01:00
shape.h geometry: derive SHAPE_LINE_CHAIN, SHAPE_SIMPLE and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI from a common base class allowing to simplify collision detection 2020-09-08 01:31:42 +02:00
shape_arc.h Comments. 2020-07-05 19:53:04 +01:00
shape_circle.h std::min/std::max requires <algorithm> 2020-07-11 15:46:57 +02:00
shape_compound.h libs/kimath: implement BBox() and Size() methods in SHAPE_COMPOUND 2020-07-29 23:14:03 +02:00
shape_file_io.h Comment-only changes 2020-01-10 16:43:01 -08:00
shape_index.h PNS: Be better about handling multiple layers 2020-08-16 12:39:15 -07:00
shape_index_list.h Refactor all math into a new kimath library 2020-01-07 17:12:59 +00:00
shape_line_chain.h geometry: derive SHAPE_LINE_CHAIN, SHAPE_SIMPLE and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI from a common base class allowing to simplify collision detection 2020-09-08 01:31:42 +02:00
shape_null.h libs/kimath: introducing empty shape object (SHAPE_NULL) 2020-09-08 01:31:42 +02:00
shape_poly_set.h Change partitions to fixed size 2020-09-10 09:31:20 -07:00
shape_rect.h Move rest of DRC to SHAPE collision architecture. 2020-07-06 20:00:50 +01:00
shape_segment.h std::min/std::max requires <algorithm> 2020-07-11 15:46:57 +02:00
shape_simple.h geometry: derive SHAPE_LINE_CHAIN, SHAPE_SIMPLE and SHAPE_POLY_SET::TRIANGULATED_POLYGON::TRI from a common base class allowing to simplify collision detection 2020-09-08 01:31:42 +02:00