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
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.
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
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
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.
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
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
There were two problems in the triangulation caching
of SHAPE_POLY_SET:
First there was a double free:
While SHAPE_POLY_SET implements the copy constructor,
it did not implement the operator=, which resulted
in the default operator= being generated by the
compiler. The default operator= copied the member
m_triangulatedPolys, which is a std::vector of pointers.
So after operator= execution, there are two SHAPE_POLY_SET
having pointers to the same TRIANGULATED_POLYGONs, each
of them deleting them in their destructors. This led
to segfaults, because calling
TransformShapeWithClearanceToPolygon on a Zone
uses operator= to copy the contained SHAPE_POLY_SET.
The new SHAPE_POLY_SET then went out of scope and
deleted the cached triangulation within the Zone.
This first problem is fixed by implementing operator=
for SHAPE_POLY_SET.
Second, there was a memory leak: Calling
"CacheTriangulation" on a SHAPE_POLY_SET,
then changing the polygon and then calling
"CacheTriangulation" again led to
leaking the
triangulations generated in the first call.
This second problem is fixed by holding
the cached triangulations in a unique_ptr.
SHAPE_POLY_SET: fix crash in VertexCount when it is a empty poly set, or when params are incorrect.
minor other fixes:
warning in degug mode in dialog_dxf_import_base.cpp
pcb_painter.cpp: remove a useless debug line.