← Back to team overview

kicad-developers team mailing list archive

Re: Remove holes and bottleneck in 3d-viewer

 

Hello Jean-Pierre,


>> What about apply the remove holes only to that "10 000 to 20 000
>> corners" (I believe the remove holes will so create more
>> corners..with the format of the hole..) and then render an outline
>> with the approximation polygon.?

>It could work for via holes, not pad holes.
>Pad holes are (most of time) on the outline (when pads have thermal
>reliefs).


I see...
I understand it now.  I was checking in detail. It first make a polygon with the interior filling and then an outline polygon for each segment.
So each segment line will have always the 2 points and then, a polygon with (lets say) 16(+2?) points to fill the borders.
And as you explained, some parts in the filling, that are very thin they only become (visible) outline polygons and they need also to be removed.



> Remember: combining polygons is not just remove holes, but also merge
overlapping polygons.

This is not very important by now, but, I was checking and for the filling zones, it is not merging the overlapping filling and outline polygons. I can render the filling and the outline.

This is constructed here:
https://github.com/KiCad/kicad-source-mirror/blob/ea11c013b60aa4255535938f269c188407692095/pcbnew/board_items_to_polygon_shape_transform.cpp#L294
// add filled areas polygons
    aCornerBuffer.Append( m_FilledPolysList );

and then it append
TransformRoundedEndsSegmentToPolygon( aCornerBuffer ..

So in the end there are the filled poly and the rounded outlines polygons.




>> Another technical question: How does the outline width/ polygon is
>> properly rendered? If we have a single point, that point will draw a
>> circle with the radius = width ?

>You cannot have a single corner: a valid polygon needs at least 3
>corners (not aligned).

Sorry I was asking regarding the outline (line) segment.
But the answer is in the TransformRoundedEndsSegmentToPolygon function (radius  = aWidth / 2)



>Be careful: GAL is a 2D representation (the copper thickness is not
>taken in account).
>The 3D viewer uses the 3D representation of the copper layers (and tech
>layers)
>It means a rectangular pad, for instance needs 6 rectangles (Top,
>Botton, and 4 sides) and a hole needs to be removed from these rectangles.
>In GAL there is only one rectangle.

I think a bit about it and looking for some openGL solutions and I think in future this work (rendering and remove holes) can be done with openGL tricks (using stencils buffers)
(Notable example: www.opencsg.org )

I need a bit more time to thinking on it but the idea would be, for a single plane layer:
- Render the disc of the holes to the stencil buffer (they will be used as a mask to cut / not draw the plane) (http://glbook.gamedev.net/GLBOOK/glbook.gamedev.net/moglgp/advclip.html )
- Render the filling polygon and the outline using the outline information directly from the board, test it against the stencil..
- In order to render thickness we can render an outline with cylinders & boxes (similar as GAL is doing in 2D with circles and rectangles to draw a segment)

The advantage in this case will be:
- No need to convert the track / filling zones to polygons and outline polygon lines
- No need to perform a remove hole operation.
- Rendering the board and extract the holes can be done in real-time?

Disadvantages:
- Still need to evaluate how much effort (rendering passes) are needed for OpenGL to do it for all the layers and thickness..


Thanks for your explanations and for share your ideas!
Regards,
Mario Luzeiro


Follow ups

References