Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @@ -27,17 +27,15 @@
- z.add(a, (-b.radius, 0))
- z.add(b, (a.radius, 0))
- - if n - 3 >= 0:
- - c = make(n - 3)
- - p = getnestpos(a, b, c)
- - z.add(c, p)
- -
- - nest(z, n - 4, b, a)
- + if n % 2 == 0:
- + nest(z, n - 3, b, a, True)
- + else:
- + nest(z, n - 3, a, b, False)
- cache[n] = z
- return z
- -def nest(z, n, a, b, recurse=True):
- +def nest(z, n, a, b, dir):
- if n >= 0:
- ap = bp = None
- for q in z.contents:
- @@ -51,9 +49,10 @@
- p = getnestpos(a, b, c, ap, bp)
- z.add(c, p)
- - if recurse:
- - nest(z, n - 1, a, c, recurse=False)
- - nest(z, n - 2, c, b)
- + if dir:
- + nest(z, n - 1, c, b, dir)
- + else:
- + nest(z, n - 1, a, c, dir)
- def getnestpos(a, b, c, ap=None, bp=None):
- # use law of cosines to get angle between a->b and a->c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement