[interpolatable] More variable reuse

This commit is contained in:
Behdad Esfahbod 2023-11-26 11:23:53 -07:00
parent ae0fac9297
commit b3697e26dd

View File

@ -851,15 +851,6 @@ def test_gen(
pt0_next = complex(*pt0_next[0])
pt1_next = complex(*pt1_next[0])
min_length = upem * DEFAULT_MIN_KINK_LENGTH
if (
abs(pt0 - pt0_next) < min_length
and abs(pt1 - pt1_next) < min_length
and abs(pt0 - pt0_prev) < min_length
and abs(pt1 - pt1_prev) < min_length
):
continue
# We have three consecutive points. Check whether
# they are colinear.
d0_prev = pt0 - pt0_prev
@ -867,6 +858,15 @@ def test_gen(
d1_prev = pt1 - pt1_prev
d1_next = pt1_next - pt1
min_length = upem * DEFAULT_MIN_KINK_LENGTH
if (
abs(d0_prev) < min_length
and abs(d0_next) < min_length
and abs(d1_prev) < min_length
and abs(d1_next) < min_length
):
continue
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
@ -876,7 +876,6 @@ def test_gen(
except ZeroDivisionError:
continue
# print("cross", abs(cross0), abs(cross1))
if abs(cross0) > t or abs(cross1) > t:
# Not colinear / not smooth.
continue