pcb

PCB includes invalid vertex into merged polygon

Bug #1521597 reported by Martin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pcb
Fix Released
High
Bert Timmerman

Bug Description

When Collect() function in polygon1.c is generating merged polyline, invalid vertex is included in some case. See attached PCB file for example of such data.

The problem is caused by Collect() and Collect1() functions and their interpretation of 'cur' parameter. The Collect1() function assumes the 'cur' is starting point of the first edge to examine (that is VNODE containing the Flags for this edge) regardless of the scanning direction. The function, therefore, includes check jumping to the
cur->next VNODE when calling Gather() if direction is not FORW.

The first call to Collect1() in Collect() function is in accordance with this assumption, but the second call after jump() test gets always intersection point, that is the point Gather() should start from, and jumping to cur->next for backward scanning direction is invalid here (as the vertex is the 'next' one already).

So the fix is removing (dir == FORW ? cur : cur->next) test from Collect1() function and including it in parameters of the first call to Collect1() in Collect() function only. (I'll attach patch to the next message as I do not see how one can add more attachments here.)

Side note: the only way how one can get backward direction from first 'if' test in Collect() is XOR rule which is not used in PCB. So one could, in fact, just drop the test completely. The XOR rule would result in invalid code anyway as the XorS_Rule() does not set the initdir when returning false and subsequent test with jump() call assumes direction is set.

Revision history for this message
Martin (l-martin-c) wrote :
Revision history for this message
Martin (l-martin-c) wrote :

Screenshot of faulty behavior of current PCB code.

Revision history for this message
Martin (l-martin-c) wrote :

OK, here is the patch.

Martin (l-martin-c)
summary: - Invalid vertex is included in merged polygon
+ PCB includes invalid vertex into merged polygon
Martin (l-martin-c)
affects: geda → pcb
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Hi,

I just tested your patch on both the gtk and the lesstif UI.

I see that the sliver in the minimal pcb file, and as seen in the picture you attached to this bug report, has gone.

Kind regards,

Bert Timmerman.

Changed in pcb:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Bert Timmerman (bert-timmerman)
milestone: none → next-bug-release
Revision history for this message
Bert Timmerman (bert-timmerman) wrote :

Pushed to master.

Thanks and kind regards,

Bert Timmerman.

Changed in pcb:
status: In Progress → Fix Committed
Changed in pcb:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.