Add direct handling of quadratic beziers to save compute time and number
of points. Update cubic interpolation to reduce number of points
generated for a given smoothness
Cache data on open and used cached data to avoid multiple re-calcs
Remove minimum line length and number of segments and replace with
standard max error level. Allows us to specify the tolerance of bezier
interpolation
VECTOR + scalar = vector type (KiROUND when VECTOR is integral and
scalar is float)
VECTOR + VECTOR = common type vector
Implemented with concepts in template rules - SWIG compatible
The previous overflow handling code casted the int_min value into an
unsigned, meaning that the min value and max value were almost the same,
clamping the output to unreasonable values.
Updated code handles floating points first, then does integer casting
through int64_t
This forces the operators -, +, * to use standard promotion rules when
operating on vectors of two different types. Previously, this depended
on the order in which the operator was called, so subtracting a VECTOR2D
from a VECTOR2I could have a different result than negating the result
of subtracting the same vectors in the opposite order
Added Distance(VECTOR2) function that returns a double. Removed
superfluous EuclideanNorm, GetLineLength, integer constructor for
EDA_ANGLE (this promotes to double in the CTOR), DistanceLinePoint and
HitTestPoints
Also extended the size for arc calculations that get distances to center
points to avoid overflow
We switch from squared to absolute calcualtion when calling into the arc
collision so be sure to catch the new positions and distances
(cherry picked from commit 160a493885)
Most of the lines in KiCad are on 45° angles. We can avoid sqrts by
recognizing that this implies the x/y values are the same. Therefore,
the length of the hypotenuse is sqrt(2) * x.
This splits the tool into two separate tools: by center and
by even gaps. Previously, this was automatically decided, based on
if the items could have any gaps between them. This was unintuitive
as it would appear to arrange by centre point sometimes but not others.
When items aren't all the same width, the results can then be very
different, based only on the starting positions.
The new behaviour is to have a dedicated tool for each, which echos
how graphical programs like Inkscape manage this.
The by-gaps method is then extended to work for overlapping items
(when items overlap, the overlaps are made equal). The logic is
centralised in kimath/geometry, and some QA is added. This should
make it easier to extend to eeschema, for example.
This also (attempts to) address some rounding issues which could
cause minor, but compounding, errors to build up along the list
of items.
Also, fix bugs in the collection filtering - previously items
like markers were filtered out only after the selection size
was used to compute the gaps between items.
The last segment of a track could be removed when the iterator does not
correctly loop. Keeping the ll within bounds and checking for
equivalency instead of comparison works for last point
When simplifying, a small difference in successive points would allow a
larger difference than aMaxError to be removed. This change checks the
intermediate points during removal to ensure we don't get overzelous
- Changes BOX2 size to extended coordinates.
- Adds BOX2ISafe to construct a BOX2I that will fit in int32.
- Adds more checks.
- Safer computations.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17670
The router needs to elimitate duplicate points but keep colinear
segments. This re-creates the partial routine from the old Simplify()
function
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17582
Check for vertex placement against original size. Since we are
potentially adding vertices that are out of order with the original
polygon, we only want to check against the first set of vertices when
checking for polygon collision
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17664
When we add vertices to the tesselation routines, we cannot reuse these
without the original vertex points.
It may be possible to copy and modify the vertices from the hint data so
that they are properly positioned but naive attempts (moving based on
first point) did not work, so for now, we disable the hint cache when
the vertex sizes do not match as this prevents OOB access
Fixes https://gitlab.com/kicad/code/kicad/-/issues/17621