Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def SampleLine(rho1, theta1, pt_min, pt_max):
- def get_intersect(rho2, theta2):
- y = (rho2 - rho1) / (math.tan(theta2) - math.tan(theta1))
- x = rho1 - math.tan(theta1) * y
- return (x, y)
- x0, y0 = pt_min
- x1, y1 = pt_max
- pts = list()
- pts += [ get_intersect(x0, 0.0) ]
- pts += [ get_intersect(x1, 0.0) ]
- pts += [ get_intersect(y0, math.pi / 2) ]
- pts += [ get_intersect(y1, math.pi / 2) ]
- pts.sort(key=lambda p: math.hypot(p[0], p[1]))
- return pts[0], pts[1]
Add Comment
Please, Sign In to add comment