Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Commit

Permalink
Fix F5_3 false positives for colinear lines (#301)
Browse files Browse the repository at this point in the history
Two lines that are colinear and have exactly one identical point are not overlapping.
  • Loading branch information
cpresser authored and poeschlr committed May 31, 2019
1 parent 89e373e commit 5e9904e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pcb/rules/F5_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def distance(a,b):
return math.sqrt((a['x'] - b['x'])**2 + (a['y'] - b['y'])**2)

def is_between(a,b,c):
# check if c is the same as a or b, then c is not between a or b
if c == b or c == a:
return False
# c is between a and b if in a virtual triangle the distances AC + BC = AB
ac = distance(a,c)
cb = distance(c,b)
ab = distance(a,b)
Expand Down Expand Up @@ -86,7 +90,6 @@ def is_same(l1, l2):
if not line in overlap:
overlap.append(line)
lines.remove(line)
#if is_between(line['start'], line['end'], line2['start']) or is_between(line['start'], line['end'], line2['end']):
if is_between(line['start'], line['end'], line2['start']):
if not line in overlap:
overlap.append(line)
Expand Down

0 comments on commit 5e9904e

Please sign in to comment.