Commit Graph

495 Commits

Author SHA1 Message Date
Jeff Young 9188838e50 RIP EDA_RECT. 2022-08-31 23:57:24 +01:00
Jeff Young b4492e0bd2 More EDA_RECE yeetage. 2022-08-31 17:19:50 +01:00
Jeff Young f17a865593 Move EDA_ITEM hitTest to BOX2I. 2022-08-31 17:18:45 +01:00
Jeff Young c7036ae076 Beef up BOX2's API so it can replace EDA_RECT. 2022-08-31 00:44:33 +01:00
Seth Hillbrand b736460e71 Move optional access from value() to *operator
`value()` throws.  Where we check for existence, we don't need to use
the throwing version and should just use the unprotected variant
2022-08-30 13:59:39 -07:00
Seth Hillbrand df8b7a8fef Fix RemoveNullSegments 2022-08-29 17:08:01 -07:00
Seth Hillbrand a7f978daf6 Fix typo 2022-08-26 16:58:21 -07:00
Seth Hillbrand 5a37211fdb Handle cases where Simplify removes all outlines
This could theoretically happen for a fully degenerate polygon

Fixes https://gitlab.com/kicad/code/kicad/issues/12120
2022-08-26 16:41:57 -07:00
Seth Hillbrand 146495672e Utilize our combine_hash routine for multiple hash
We should be using the one routine every time we want to build a hash
from indepedent values rather than rebuilding it differently in multiple
places
2022-08-26 08:45:13 -07:00
Seth Hillbrand 06786c34d7 Blacklist hashes for 2d integer elements
The hash table for integer hashes is extremely limited and places most
elements in the same buckets.  This leads to a linear search time for
structures built on this.

This blocks hashes, directing the coder to utilize std::set or std::map
structures instead of hash tables for implementing integer-based
lookups.
2022-08-26 08:43:37 -07:00
Seth Hillbrand f1261e71d4 Replace boost::optional with std::optional 2022-08-25 15:50:47 -07:00
Marek Roszko f63a099fad Remove unused function to squash warning 2022-08-21 18:23:28 -04:00
Roberto Fernandez Bautista 1fa1b44d02 Fix SHAPE_LINE_CHAIN::Simplify() when there are only 3 points in the chain
We weren't updating m_shapes properly.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/11695
2022-08-19 20:49:49 +01:00
Jeff Young 96f01d33c8 Performance improvements.
1) Move a bunch of std::map's to std::unordered_map to get constant-time
look-ups
2) Lengthen progress-reporting intervals to spend more time doing work
and less time talking about it
3) Reverse order of SHAPE_LINE_CHAINs in thermal intersection checks to
make (much) better use of bbox caches
4) Don't re-generate bboxes we already have
5) Fix some autos that weren't by reference (and were therefore copying
large datasets)
6) Rename delta progressDelta so it's easier to search for in future
7) Get rid of a few more autos (because I don't like them)
8) Pass large items to lambdas by reference

Fixes https://gitlab.com/kicad/code/kicad/issues/12130
2022-08-03 11:59:42 +01:00
Seth Hillbrand 3594a06475 Fix simplify routine
The change in c9c31fcbc2 missed a number of cases.  This reverts back to
the system as it existed before 2be352b9f9
but using the revised method of determining A-B-C distance and avoiding
resizing the arrays

(cherry picked from commit 675a5a6e7b)
2022-08-01 09:50:17 -07:00
Seth Hillbrand 2039a1bc8b Don't resize vectors in hot loops
Fixes a slowdown caused by erasing elements from the middle of a vector
during a hot loop in SHAPE_LINE_CHAIN::Simplify().  This gets called
quite a bit when loading boards and updating lines, so it needs to be as
fast as possible

Fixes https://gitlab.com/kicad/code/kicad/issues/12115

(cherry picked from commit c9c31fcbc2)
2022-07-31 12:48:52 -07:00
Seth Hillbrand f6d2164cb0 Fix crash in PNS walkaround
Placing via in walkaround mode and colliding with an arc triggered an
unneeded assertion.

Also fixes the bad assertion format that did not receive strings

(cherry picked from commit df9cf0a0c3)
2022-07-28 09:40:41 -07:00
jean-pierre charras 81d9524e03 Fix missing header. 2022-07-25 18:41:38 +02:00
jean-pierre charras 130723ebac VECTOR2D CalcArcCenter( VECTOR2D& aStart, VECTOR2D& aEnd, EDA_ANGLE& aAngle ):
fix broken calculation of arc center for arcs > 180 degrees.
Fixes #11708
https://gitlab.com/kicad/code/kicad/issues/11708
2022-07-25 18:23:52 +02:00
Jeff Young 032708860b Include both text shapes and border shapes in textbox.
Fixes https://gitlab.com/kicad/code/kicad/issues/11806
2022-07-25 16:10:08 +01:00
Seth Hillbrand 00f0d229bf Fix incorrect comment in previous commit 2022-07-21 15:52:54 -07:00
Seth Hillbrand 16e3d40552 ADDED: Display calculated clearance in status bar
In addition to showing resolved clearance, we also show the calculated
clearance in the same method as is used for DRC.  This will allow users
to better examine their system while working.

Fixes https://gitlab.com/kicad/code/kicad/issues/7934
2022-07-21 15:44:48 -07:00
Jeff Young b727bfc16d Performance: avoid sqrt at all costs. 2022-07-16 18:42:32 +01:00
Alex c107abe247 math: Use intrinsic functions for 64-bit rescale on MSVC. 2022-07-16 17:37:50 +00:00
Seth Hillbrand eccbb374a0 Add debug message to VECTOR3 check 2022-07-16 17:28:40 +00:00
Marco Langer 1606bfc9f8 fixed a runtime divide by zero crash for integral type template instanciations and made the class trivial copyable to increase performance 2022-07-16 17:28:40 +00:00
Alex 27869b1a37 Don't recalculate constants at every call in isqrt. 2022-07-16 14:53:18 +00:00
Jeff Young 0953395c87 LIB_SHAPE slightly abuses SHAPE_POLY_SET by using it for line chains.
Fixes https://gitlab.com/kicad/code/kicad/issues/11956
2022-07-08 21:35:40 -06:00
Seth Hillbrand 6fef054c51 Handle basic rounding error in schematic import
The fractional part of Altium schematic units is an integer number of
1/10000 mil segments, which is 2.54 nm.  The internal unit of eeschema
is 10 nm, so each fractional unit in Altium is 0.254 base eeschema
units.  To be consistent with
cf33cfcad1
we round to the nearest 10nm for each element

Fixes https://gitlab.com/kicad/code/kicad/issues/11742
2022-07-07 11:13:11 -07:00
Seth Hillbrand a8c6488358 Remove warning 2022-06-24 13:55:05 -07:00
Seth Hillbrand a118f20464 Hide cursor while warping on Wayland
Based on https://gitlab.freedesktop.org/xorg/xserver/-/issues/734 we
hide the window cursor prior to warping, which allows XWayland to
reposition the cursor.  This is only performed when Wayland is detected;
all other configurations call the standard warp routine

Fixes https://gitlab.com/kicad/code/kicad/issues/9785
2022-06-24 09:56:43 -07:00
Jeff Young 82ebc247b8 More performance enhancements for DRC. 2022-06-18 19:47:11 +01:00
Tomasz Wlostowski 3aed13278d geometry: more robust colinearity test in SHAPE_LINE_CHAIN::Simplify()
We now test the midpoint (B) of the 3 consecutive polyline points (A, B, C), since (assuming the angle between AB and BC is > 90 degrees) AC is always longer than
AB or BC. This minimizes the distance computation rounding error (in the previous algorithm, taking the point C for colineraity test) if AB is short and BC is very long, the test would
often fail due to rouding error in projection/line distance computation
2022-06-03 23:28:41 +02:00
Tomasz Wlostowski e6ebc2b9b9 geometry: use dedicated 64-bit integer square root for distance computations
Guarantees 1 LSB error, while the C++ double type has 55 mantissa bits (meaning for sqrt(X) >~ 2^22.5) the error is not guaranteed.
2022-06-03 23:28:41 +02:00
jean-pierre charras 046045f9de CalcArcCenter(): fix broken calculation of the arc center.
This function is used in the graphic items properties dialog, and each
arc edition from this dialog breaks the arc center position
Fixes #11703
https://gitlab.com/kicad/code/kicad/issues/11703
2022-05-31 10:48:54 +02:00
Tomasz Wlostowski 42e53ee8e9 kimath: fix regression in BuildInitialTrace()/CalcArcCenter causing incorrect arcs in routed traces 2022-05-27 17:41:05 +02:00
Mike Williams 9d90699358 Shape Assertions: print the correct type names
It still asserts, but at least for the right reason.
2022-05-26 15:32:45 -04:00
Seth Hillbrand 2a9d7314ca Initialize area check
Ensure that the max_poly set is zero before using
2022-05-26 08:19:16 -07:00
Seth Hillbrand 7dd0c67afd Handle hand-drawn holes in unfracture
We can't know that all holes will be ccw when entering unfracture.
Instead, we set the largest polyline to be the outline and the others to
be the holes.

(cherry picked from commit 1fe956c069)
2022-05-25 13:21:04 -07:00
jean-pierre charras 9108404efe Gerbview: seriously speed up the calculation time to draw polygons on OpenGL.
Mainly CacheTriangulation() was creating triangles using partition mode.
But this mode is optimized for Pcbnew and Gerbview and different internal units.
Now CacheTriangulation() is used in no partition, much faster in GERBVIEW_PAINTER.
Fixes #11549
https://gitlab.com/kicad/code/kicad/issues/11549
2022-05-13 18:20:35 +02:00
Jeff Young 728777da7c While icons aren't often used in Mac menus, they *are* supported. 2022-04-24 14:39:00 +01:00
Marek Roszko c64ea07d0b Check HKCU before HKLM for registry policies 2022-04-12 21:42:20 -04:00
Marek Roszko 392ed5fecd Add policy to enable/disable pcm 2022-04-12 10:08:34 -04:00
Roberto Fernandez Bautista 4defc946ef Fix rounding errors in SHAPE_ARC::Collide + fix qa tests
Use CIRCLE::NearestPoint to ensure consistency
2022-04-11 13:46:36 +01:00
Marek Roszko b3c5054d6c Add initial system policy checking for turning off data collection 2022-04-09 14:05:28 -04:00
Jeff Young 007906cd16 Fix a degeneracy bug in arc collisions.
This also fixes a failure to use the correct effective width for
shapes (which might, for instance, inherit their widths from schematic
defaults, netclasses, etc.).

Fixes https://gitlab.com/kicad/code/kicad/issues/11358
2022-04-08 16:15:58 +01:00
Seth Hillbrand 0625e20fc0 Cleanup spacemouse plugin
Sets std:: convention and unifies the defined/non-defined interface
2022-04-01 15:14:41 -07:00
markus-bonk 1a9ef4bd0f Add support for using a SpaceMouse to pan & zoom in the schematic editor. 2022-03-31 19:03:41 +00:00
Wayne Stambaugh 7b2d9dfc0c Fix some Coverity uninitialized scalar variable issues. 2022-03-24 13:17:07 -04:00
Seth Hillbrand 363ea99157 Avoid duplicate points in trapezoid pads
Duplicate points can be either positive-facing or negative facing, so
test absolutes

Fixes https://gitlab.com/kicad/code/kicad/issues/11025

(cherry picked from commit 207820e112)
2022-03-22 13:30:45 -07:00