A 360° arc will have the mid point on the opposite side of the circle
from both the start and end points. This will make both slopes the
same, leading to a degeneracy in the calculation. We address this by
noting that the center will be halfway between the midpoint and the
start point.
Returning the poly index is not useful as it does not allow the use of
other SHAPE_POLY_SET Hole* functions that expect to get the indices of
holes rather than the outline
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#4805https://gitlab.com/kicad/code/kicad/issues/4805
1) An actual distance of 0 is still a collision, even if the allowed
distance is 0.
2) Be consitent about edges and interiors. Everyone expect the edge
of a RECT to be part of the RECT; same with a CIRCLE. SHAPE_POLY_SET
shouldn't be any different. (And SHAPE_LINE_CHAIN was a split-
personality with the edge considered part of it for Collide() but not
for PointInside()).
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).
Dragging filled zones in OpenGL was extremely slow due to the
invalidated triangulation cache. Moving the zone should also move the
triangles and keep the cache valid.
The hittest needs to use distance calc rather than squared distance.
This also adjusts the radius value to be double as to avoid unneeded
loss of precision
The arc shapes need to connect with their adjacent points. By storing
the relevant points, we allow exact point matching on both ends of the
arc as well as localize point storage.
* Implement ReparentQuasiModal for OSX natively
* Implement ForceFocus of OSX natively
This change means we no longer rely on the kicad-specific functions in our osx wx fork.
Previously, all overlapping polygons (pads and min thickness areas to remove) were
merged.
Drawback: pads attributes are lost. In Gerber this is annoying.
Now the pads are plot as flashed or Regions items, and min thickness areas are added
but shapes are not merged and keep their attributes.
This only tests the InterceptsPositiveX() and InterceptsNegativeX() used
for finding the midpoint of an arc.
Tidy up some of the trigo.h header Doxygen comments.
This implements all existing symbol library object support and the ability
to save and load symbol library files between file formats for round robin
testing.
Creates new substructure for arc management. Existing functions provide
wrapper to use SHAPE_LINE_CHAIN as normal, without arcs while also
permitting the addition of arcs into the chain
- Fix non optimal shape of solid polygons after inflate transform.
- Add a small extra clearance ((2 microns) when creating clearance areas
(especially, convert arc to polygons create small differences)
- Add a small threshold (1 micron) in drc test distances to avoid false positives
- fix a minor issue in TransformOvalToPolygon that created sometimes a not perfect shape
Fixes#3812https://gitlab.com/kicad/code/kicad/issues/3812
The new line collision search uses BBox() to check for colliding
objects. BBox in the SHAPE_LINE_CHAIN did not include width as the
chains were assumed to be zero-width. This is not the case for
PNS::LINE elements.
We mostly don't notice this because DRC checks for SEGMENT collisions
but it becomes obvious/annoying when we cannot place a track for unknown
reasons and the snap-back doesn't take line width into account.
Fixes#3776 | https://gitlab.com/kicad/code/kicad/issues/3776
* 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.
Use std::unique_ptr to guard against leaking the new'd pointers
in SEXPR lists if there is an exception during parse.
This was noticable during the Sexpr/ParseExceptions unit test.
Fixes: lp:1830209
* https://bugs.launchpad.net/kicad/+bug/1830209
The SEXPR class is a useful general-purpose S-Expression library
class and can (maybe) be used else where. It also should get
test coverage, as even if noone else uses it, it's critical for the
kicad2step exporter.
Also add some test coverage for some kicad2step routines. For now,
they're not useful outside kicad2step, but they are at least a useful
reference for S-Expression parsing.