(p1,p2,y)
| 7 | import numpy as np |
| 8 | |
| 9 | def f(p1,p2,y): |
| 10 | if abs(p1[1]-y) > abs(p2[1]-y):p1,p2 = p2,p1 |
| 11 | k =1.0* (p1[1]-y)/(y-p2[1]) |
| 12 | return round((p1[0]+k*p2[0])/(1+k),4) |
| 13 | |
| 14 | def scan(polys, idx, ys, st, y, cur, buf): |
| 15 | while cur<len(idx) and ys[st[cur]]<=y: |