PCB includes invalid vertex into merged polygon
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.
summary: |
- Invalid vertex is included in merged polygon + PCB includes invalid vertex into merged polygon |
affects: | geda → pcb |
Changed in pcb: | |
status: | Fix Committed → Fix Released |
Screenshot of faulty behavior of current PCB code.