← Back to team overview

kicad-developers team mailing list archive

Re: PCBNew: Segments/polygons not rendered correctly (from Bug 1806411])


Le 18/12/2018 à 18:18, Seth Hillbrand a écrit :
> Am 2018-12-18 07:15, schrieb jp charras:
>> Le 17/12/2018 à 22:26, Seth Hillbrand a écrit :
>>> Hi JP-
>>> Am 2018-12-17 08:47, schrieb jp charras:
>>>> Note the incorrect rendering happens only when footprints are flipped.
>>> Thank you for the samples.  I had coded the tesselation assuming the
>>> copper layers, which always have the polygon in CW order for the outline
>>> and CCW for the holes.  But flipped footprints put the line chain in the
>>> reverse order, so they render incorrectly.
>>> I've added some checks for the winding order to the code and re-enabled
>>> the polygon caching.  Let me know if you see any issues.
>> Thanks Seth.
>> Could you have a look into my commit 388397f97.
>> I want to be sure I did not break your code.
>> I modified Gerbview to use your tesselation.
>> During my tests, I found a crash with degenerated polygons (having less
>> than 3 corners).
> Hi JP-
> That should not cause any issues.  But I think it is degenerate with the
> test immediately following:
> if( !firstVertex || firstVertex->prev == firstVertex->next )
> I've adjusted the CacheTriangulation() routine to correctly handle the
> case when tessellation fails.  Specifically, it will set
> m_triangulationValid=false if any of the polygons fail triangulation. 
> This should work because DrawPolygon() falls back to the built-in OpenGL
> triangulation if the triangulation is not cached.  The exception is in
> the 3dviewer, which does not draw polygons.  For this reason, we still
> attempt the remaining triangulation even after we set the failure flag.
> Let me know if you see any issues.
> Best-
> Seth

Sorry Seth,

But with your fixes, CacheTriangulation() crashes with degenerated polygons.

To see that, modify gerbview_painter.cpp, line 265 to remove
absolutePolygon.COutline( 0 ).PointCount() < 3
and try to load the test file test_polygons_with_arcs.gbr in Gerbview.

Jean-Pierre CHARRAS

Follow ups