[interpolatable] Minor variable reuse

This commit is contained in:
Behdad Esfahbod 2023-11-26 10:51:00 -07:00
parent 6a87a3cb2f
commit 0e1113c1bb

View File

@ -862,16 +862,17 @@ def test_gen(
# We have three consecutive points. Check whether # We have three consecutive points. Check whether
# they are colinear. # they are colinear.
cross0 = (pt0 - pt0_prev).real * (pt0_next - pt0).imag - ( d0_prev = pt0 - pt0_prev
pt0 - pt0_prev d0_next = pt1_next - pt1
).imag * (pt0_next - pt0).real d1_prev = pt1 - pt1_prev
cross1 = (pt1 - pt1_prev).real * (pt1_next - pt1).imag - ( d1_next = pt1_next - pt1
pt1 - pt1_prev
).imag * (pt1_next - pt1).real cross0 = d0_prev.real * d0_next.imag - d0_prev.imag * d0_next.real
cross1 = d1_prev.real * d1_next.imag - d1_prev.imag * d1_next.real
try: try:
cross0 /= abs(pt0 - pt0_prev) * abs(pt0_next - pt0) cross0 /= abs(d0_prev) * abs(d0_next)
cross1 /= abs(pt1 - pt1_prev) * abs(pt1_next - pt1) cross1 /= abs(d1_prev) * abs(d1_next)
except ZeroDivisionError: except ZeroDivisionError:
continue continue