7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-02 00:26:45 +00:00
Commit Graph

742 Commits

Author SHA1 Message Date
JamesJCode
906c24bc6d Unify length calculation between router, board / frame, and DRC 2025-03-30 09:18:41 +01:00
Seth Hillbrand
de09403b10 Fix mistake in arc circle collision
Need to test nearest point from the circle center to the arc.  Add QA to
prevent regression

Fixes https://gitlab.com/kicad/code/kicad/-/issues/20336
2025-03-14 18:06:09 -07:00
Alex Shvartzkop
dc961d37ad Optimize SHAPE_LINE_CHAIN_BASE::EdgeContainingPoint. 2025-03-09 16:27:07 +03:00
Alex Shvartzkop
b91e005277 Pre-fetch segments in SHAPE_LINE_CHAIN::SelfIntersecting. 2025-03-09 16:27:04 +03:00
Alex Shvartzkop
a82916f4db Improve performance of SEG::Contains. 2025-03-09 16:27:01 +03:00
Alex Shvartzkop
18d836ef8b Reduce CSegment calls in SHAPE_LINE_CHAIN::SelfIntersecting. 2025-03-09 16:26:57 +03:00
Seth Hillbrand
c24832f72b Fix IsEffectiveLine calculation
We sometimes represent circles as 360° arcs.  These are approximately
colinear but are definitely not a line
2025-03-06 12:45:10 -08:00
Jeff Young
3f15b0d75b ADDED: hatched fills for shapes. 2025-02-24 11:08:29 +00:00
Jeff Young
e483c48fe6 Re-balance file sizes. 2025-02-24 11:08:28 +00:00
jean-pierre charras
dc1ecea4bc OUTSET_ROUTINE::ProcessItem(): handle an exception thrown for incorrect prm.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19880
2025-02-07 19:47:48 +01:00
John Beard
43be371f83 Kimath: don't access aActual unless set
Avoids at least one test failure in qa_pcbnew
due to uninitialised access.
2025-01-24 20:26:31 +08:00
Seth Hillbrand
0281bfe05e Fix missing display pads on MacOS
The distance from any point in the negative quadrant to
std::numeric_limits::max will be larger than std::numeric_limits::max,
meaning that if we take the square of this value, we will overflow the
extended_type.  Overflows are undefined behavior when dealing with
signed integers (c.f. C99 §3.4.3/1) so while most compilers retain a
positive value, Apple, in release mode, overflows into the sign bit,
resulting in a negative number for the squared distance.

This prevented us from displaying certain shapes in the negative
quadrant on MacOS, only in release mode builds

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19424
2025-01-21 20:05:25 -08:00
Alex Shvartzkop
3a0df97dbf Optimize SHAPE_LINE_CHAIN::Segment slightly. 2025-01-15 18:07:57 +05:00
Seth Hillbrand
5cd9e319d3 Handle more arc degeneracies 2025-01-14 13:08:45 -08:00
Seth Hillbrand
bfb3875a68 Add additional handling for arc collisions
Provides nearest point calculation for circles, segments and rects

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18203
2025-01-14 13:08:45 -08:00
Seth Hillbrand
bcebc694b8 Implement MTV for arcs 2025-01-14 13:08:45 -08:00
Seth Hillbrand
b73481dd49 Update SHAPE_ARC::IntersectionPoints()
Force it to handle a number of edge cases from Arc-Arc collision test.
Unify and simplify the Collide Arc-Arc.  Add additional arc collision
QA test
2025-01-14 13:08:45 -08:00
Jeff Young
77a524fa22 Fix slicing operator.
(Also a minor performance improvement.)
2025-01-14 12:41:16 +00:00
Seth Hillbrand
3e8791b88d Fixup multiple issues with DP checks
Handle arcs properly even when not exactly concentric.  Properly check
for interfering elements that would prevent coupling.  Avoiding those
that are directly connected

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17967
2025-01-13 16:11:16 -08:00
Alex Shvartzkop
9a3d7594d9 Add pivot/pan/rotation/lights controls to PCB render dialog. 2025-01-05 11:42:58 +05:00
Seth Hillbrand
9a10d2ff54 Silence SWIG warnings
Expressly state which operator will work in Python (which doesn't really
know integers anyway)
2025-01-01 19:47:13 -08:00
Seth Hillbrand
0b2d4d4879 Revise Copyright statement to align with TLF
Recommendation is to avoid using the year nomenclature as this
information is already encoded in the git repo.  Avoids needing to
repeatly update.

Also updates AUTHORS.txt from current repo with contributor names
2025-01-01 14:12:04 -08:00
Jon Evans
a4ac22f2d6 SHAPE_POLY_SET: Fix up non-closed outlines when added 2024-12-30 20:33:51 -05:00
Seth Hillbrand
8724a7da09 Treat straight arcs as segments
When an arc has a very small curvature, we should not waste time with
the arc collision mode and instead just use the segment collision as it
is effectively the same result

Fixes https://gitlab.com/kicad/code/kicad/-/issues/19422
2024-12-30 12:57:21 -08:00
jean-pierre charras
f8ae28578f SHAPE_LINE_CHAIN() ctor: ensure arc info exists before trying to add it
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19419
2024-12-30 11:47:30 +01:00
Seth Hillbrand
e9bc8cfe9d Give Clipper1 a Viking funeral
Clears out the last spot where we were only using Clipper1 (how'd I
miss that?) and remove all calls to the Clipper1 structures
2024-12-23 17:12:09 -08:00
John Beard
e2136db5c2 Fabmaster: handle squares, oblongs, and regular polygons.
Fabmaster supports at least triangles, hexagons x and y, octagons
and diamonds.
2024-12-03 20:08:12 +08:00
John Beard
926ef7677b Fabmaster: never add null holes to polygons
By adding points to holes as we go, we leave ourselves open
to adding invalid (<3 point) holes to the polygons. This causes
crashes if it happens, so we should never allow it to happen.

Instead of building holes in-place, construct them externally
and only add them if they are valid.

This probably wouldn't actually happen for a valid Fabmaster
file, but if it did, it would be bad new, and we shouldn't leave
crashable pathways facing user input.
2024-12-03 20:08:12 +08:00
jean-pierre charras
d3bcc81d5d libkimath: fix a link issue on mingw/msys2 build.
Remove option "use Clipper1" (now outdated) on all platforms.
Use of advanced config created the issue, so it is just disabled on msys2.
Should not change anything on other platforms.
2024-12-01 09:38:49 +01:00
Marek Roszko
904e0cd87e Silence build warning about int to double cast 2024-11-29 10:55:21 -05:00
John Beard
df933df416 Multichannel: split out some geometric routines
Putting them somewhere in the geom utils means they
can be reused, and also tested if needed.
2024-11-08 19:48:03 +08:00
Seth Hillbrand
7916b1ddb8 Fix error in PointInside
If we are checking a point that is inline with multiple segments, we
were counting both the entry and exit as crossings, leading to points
inside a polygon being registered as outside.  Changing the conditional
to only catch one crossing as required.

Adds a QA check to ensure that this remains fixed

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18377
2024-11-07 09:09:00 -08:00
Jon Evans
d0b2334ceb PNS: Support via stacks 2024-11-04 21:30:38 -05:00
Tomasz Wlostowski
f7e37bf9f2 kimath: bring back the legacy SHAPE_LINE_CHAIN::Simplify() function
It looks like the new variant (with aMaxError) behaves in a subtly different way, resulting in router hiccups.

This needs more in-depth investigation, but for the moment, the older function does the job.
2024-11-02 19:59:09 +01:00
Armin Schoisswohl
f1abdfa1aa Modify Circle approximate segment count
Change number of segments of circles to be multiples of 8 and start rotated by delta/2.  This ensures that segments will be aligned to a 45°/90° grid

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18654
2024-10-28 20:40:05 +00:00
Seth Hillbrand
8dda9b37fa Change zorder to use unsigned
Edge cases can happen where point + clearance is larger than the bbox.
This can cause the zOrder min and max to get switched as max get a high
bit and is negative.  Clamping to limit the input values and using
uint32 for the output solves the corner case
2024-10-24 17:40:25 -07:00
Seth Hillbrand
64ff47c594 Handle edge cases in kissing zones
When zone kisses happen from different polygons, we need to be careful
not to use the different polygons for ear comparisons or prev/next
pointers

Fixes https://gitlab.com/kicad/code/kicad/-/issues/18654
2024-10-24 17:40:25 -07:00
John Beard
201b60c670 Point editor single-corner chamfer tool
Come up with a plausible default chamfer size, rather
than prompting every time with a modal (and then you have
to handle when the chanfer doesn't fit). This could be
changed if it's more annoying this way. But if we had
proper edge-dragging in zones, probably would be better
than setting a chanfer manually.

Also fix the GetNeighbourIndexes which seems to have
always been broken (but is not actually used by anything at
present).

Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/16771
2024-10-13 11:10:49 +08:00
John Beard
58669f2b9f BOX2: Correct a clamp
std::clamp is (v, min, max), but alg::clamp is (min, v, max).

I can't quite get my head round why this only causes test failures
on some platforms.
2024-10-09 11:42:16 +08:00
John Beard
55370e7520 QA: BOOST_CHECK to _TEST in some KiMath tests
This tells you the arguments when it fails.

BOOST_TEST is available in all our Boost.Test version.
Even if you didn't use it, these calls should have been
BOOST_TEST_EQUAL(A, B) which also tells you the
arguments on a test failure.
2024-10-09 11:42:16 +08:00
John Beard
91dca89116 Eeschema: Add indicator icons for pins with alt modes
This makes it easier to see which pins have alt modes
available. There is an option to turn them off.

The icon positions are chosen so they they shouldn't
interfere as far as possible:

* If the text is inside, the icon goes more inside
  the body
* If the text is above/below the pin, it goes away from
  the body

This means it won't collide with a symbol wall in
most cases, but some symbols with alt pins on opposing
sides may need to be widened if the icons are show.

Includes a rather fiddly refactor of the SCH_PIN painter
function, which needs quite a lot of massaging to allow
it to figure out where an icon would go. Quite a bit
of logic is broken out into smaller encapsulations with
less visible state to each chunk.

Icon modes for base-name-selected and alt-selected are
included, but only the former works due to information
being thrown away during the SCH_PAINTER tempPin
process.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/11069
2024-10-08 23:30:50 +08:00
John Beard
a4cbd0adb4 Sym edit: allow to drag pins with edges
Only applies when dragging an edge by the midpoint handle,
and only in the symbol editor if configured to do so.
2024-10-01 18:06:26 +01:00
John Beard
3f131e2011 Abstract REFERENCE_IMAGE to a separate class
Break the non-PCB-specfic parts of PCB_REFERENCE_IMAGE out
to a common REFERENCE_IMAGE class, which is then composed into
the PCB_REFERENCE_IMAGE. This will make it easier to bring the
transform origin logic to eeschema without repetition.
2024-09-30 10:20:20 +01:00
John Beard
889e24988b Reference image: avoid overflow on large scales
This has always been possible (especially through the properties
panel with large scales), but it's even easier if the transform
origin is near a manipulated corner.

Check and reject scales that result in an overflowed image box.
2024-09-28 13:24:26 +01:00
John Beard
215533f31a Unify flip direction handling
There was a gentle mish-mash of booleans, some with
true being left/right and some up/down, and some functions that
can flip in both axes (which is never actually done, and doesn't
really make geometric sense).

Replace all this with the FLIP_DIRECTION enum class, which makes
the intention completely unambiguous.

This also then allows a small scattering of simplifications,
because everything takes the same type and you don't have to
fiddle booleans to fit.
2024-09-27 17:13:13 +01:00
John Beard
4e2162fc97 Bezier: add the function to get point at t
Not of huge practical use on its own, but other maths will
need this.
2024-09-27 17:13:13 +01:00
John Beard
e2370c6e45 BEZIER: Avoid some copying in the ctor 2024-09-25 22:17:33 +01:00
John Beard
aea42a5cdf Pcbnew: handle connected copper circle points
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/18774
2024-09-25 12:28:43 +01:00
John Beard
95beedb612 Dogbones: add slots for acute angles
It's actually not as hard as I thought, though
surely has wierd edge cases which users might need to
handle manually.
2024-09-22 13:45:19 +01:00
John Beard
a5e6f70122 Dogbone: handle small mouths even better
Including floating point roundoff, which can bite
for rectangles.
2024-09-20 10:57:07 +01:00