kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #17931
Re: Remove holes and bottleneck in 3d-viewer
Le 13/04/2015 15:27, Mário Luzeiro a écrit :
> Hi Jean-Pierre,
>
> As we know, one of the bottleneck in 3d-viewer is while exporting the pcbboard to polygons and then remove the holes from the fill zones.
> I was trying to understand the process of that and in the sources and see if we have room for improvement.
>
> " // Draw copper zones. Note:
> // * if the holes are removed from copper zones
> // the polygons are stored in bufferPolys (which contains all other polygons)
> // * if the holes are NOT removed from copper zones
> // the polygons are stored in bufferZonesPolys"
>
> So, the only different while extracting the holes is to have the information form the filling zones? Why in that case it is causing so much more CPU effort?
>
> Then,
>
> " // bufferPolys contains polygons to merge. Many overlaps ."
> " // Calculate merged polygons"
>
> "// Merge polygons, and remove holes
> currLayerPolyset -= polysetHoles;""
>
> I was wondering if the polygons are really merged?
> I mean, if we add a fill zone in the copper, it should overlap tracks (ex GND / Power tracks of the zone) so, that track polygon information are not needed and can be merged .. some how?
> Can we gain any speed if we combine this overlap polygons?
>
> Also, what about if we perform the remove holes by split it somehow? ex: remove holes per zone, per track? ..
>
> I dont know how that (boost) algorithm works, I was thinking if it have less data to process it could be faster, so a hole will only remove polygons that we know (somehow) in advance that are hit by a hole?
>
> Do you have any other ideas and how this can be improved?
>
> Thanks!
> Regards,
> Mario Luzeiro
>
To understand why removing holes in copper zones is so time consuming,
remember how filled zones are made:
They combine 2 different things:
* the polygon itself.
* the outlines which have a thickness(which it is the minimal zone
width). they are rounded ends segments.
In 3D viewer, each zone is converted to an equivalent polygon:
the main polygon itself and its outline (each thick segment of the
outline is converted to a polygon, which overlaps the main polygon)
For large and complex zones, the number of polygon corners can be very
large (10 000 to 20 000 corners, and if each segment is approximated by
a 16 corners polygon, it gives 150 000 to 300 000 corners).
To remove holes from zones, you have to combine these polygons to others.
Therefore, combining these polygons to remove holes (this is what makes
the line: currLayerPolyset -= polysetHoles;) is very time consuming
because you can have hundred of thousand of corners to combine in a
power plane.
When the holes are not removed from zones, the number of corners to
combine is (by far) not so large, and calculations are faster.
You asked:
"Also, what about if we perform the remove holes by split it somehow?
ex: remove holes per zone, per track? .."
I already tried: the calculation time is higher, because you have to
make twice some calculations (for instance: remove the same holes from
tracks and zones) and this is equivalent to combine more polygon corners.
--
Jean-Pierre CHARRAS
Follow ups
References