kicad-developers team mailing list archive
Mailing list archive
Re: Cost of different courtyard elements for the closed outline and DRC algorithms
Disclaimer: I'm saying this all from a position of total ignorance on
the actual benchmarked cost of these computations (premature
optimisation and all that...), or even how the DRC does it.
I think most real components are easy: rects or circles. Generic
polygon collision tests are the hardest, and they get harder with more
If there is concern about performance of the collision checking, I
would start with memoising bounding boxes and use for a quick first
check with an R-tree. This will avoid 99.9% of full checks, and it's
already done for the visibility of items. From a quick check of the
DRC, it's not done like this (unless Clipper does it), so there's a
big win to be had right away.
There are some kinds of polygons that can be done more easily, but
these do not have format support in KiCad, so it's probably
impractical to detect them and special-case the handling (at least, no
faster than just doing the check). Again I have no proof that the
current Clipper code is actually slower in this case that a custom
* Rounded rects (worst case: two rect tests and four circles).
* "Easy" polygons made of superimposed rects - think a TQFP with
"bites" in the corners.
All that said, I would be tempted to avoid over-complex courtyards for
more prosaic reasons like "they're harder to edit".
@Rene: can you give some examples of "extensive" arc use on the
courtyard layers that you are thinking of?
On Tue, Jan 1, 2019 at 9:47 PM Jeff Young <jeff@xxxxxxxxx> wrote:
> SMD items are likely to be denser and have square pads. Not using shaped courtyards for them might make sense.
> Electrolytic capacitors usually have a least one round pad, so the courtyard collision time will be less than the pad collision time (which has to check with many more objects). Square courtyards keep you from packing an offset array of them, and they keep you from putting smaller components in the corners. Using shaped courtyards for them would be a clear improvement.
> There’s no doubt a lot of stuff in between those two….
> > On 1 Jan 2019, at 21:18, Jean-Paul Louis <louijp@xxxxxxxxx> wrote:
> > Seith,
> > Let me strongly disagree with you. When you have a board with over 3000 SMT parts, rounded courtyards would be a disaster.
> > I have build a lot of board with over 4000 parts, and that is not unreasonable in the professional world, So if you want to limit the use of Kicad to hobbyist, it is fine as complex shape courtyards is just a gimmick and has ZERO value in term of manufacturing engineering.
> > Jean-Paul
> >> On Jan 1, 2019, at 2:39 PM, Seth Hillbrand <seth@xxxxxxxxxxxxx> wrote:
> >> Hi Rene-
> >> Am 2019-01-01 11:57, schrieb Rene Pöschl:
> >>> Hi,
> >>> Right now we have a few contributions for the library that use arcs
> >>> quite extensively on the courtyard layer.
> >>> I would therefore like a bit of input.
> >>> Are arc generally more expensive than lines?
> >> Yes. Arcs are generally computed as a series of segments, so they are up to 64x more computationally expensive. BUT... This is the difference between a tiny fraction of a millisecond and 64 tiny fractions of a millisecond. In other words, you wouldn't notice the difference in the DRC runtime even with a modest computer.
> >>> Is there a difference if the arc is a multiple of 90 degree compared
> >>> to any other angle.
> >> No.
> >>> Is there a difference if the endpoints of two neighboring endpoints
> >>> meed exactly vs they being within the tolerance range for counting as
> >>> a closed outline (If i remember correctly then the tolerance was
> >>> 0.01mm. I assume this is the radius of the tolerance circle.)
> >> Right now this is hard-coded with a magic number to be 0.05mm. This seems to be a reasonable number and probably won't change without specific reason.
> >> Personally, I don't see any reason to prohibit arcs in the courtyard. While one use of the layer is to provide mechanical keepout as others have mentioned, it serves other purposes as well and IPC 7351 18.104.22.168 explicitly states that it is to be used as a starting point for the minimum area of the component + landing pads. Therefore if a manufacturer wants to only use rectangles, they will simply convert each to a bounding box and add their specific manufacturing allowance. Designers will need to modify the courtyards in their designs based on the DFM feedback, so the initial courtyard should be considered a minimum suggestion.
> >> -Seth
> >> _______________________________________________
> >> Mailing list: https://launchpad.net/~kicad-developers
> >> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> >> Unsubscribe : https://launchpad.net/~kicad-developers
> >> More help : https://help.launchpad.net/ListHelp
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help : https://help.launchpad.net/ListHelp
> Mailing list: https://launchpad.net/~kicad-developers
> Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help : https://help.launchpad.net/ListHelp