MCPcopy Create free account
hub / github.com/ActiveState/code / c

Function c

recipes/Python/577316_C_Fractal_using_recursion/recipe-577316.py:11–22  ·  view source on GitHub ↗
(xa, ya, xb, yb)

Source from the content-addressed store, hash-verified

9draw = ImageDraw.Draw(image)
10
11def c (xa, ya, xb, yb):
12 global draw
13 xd = xb - xa
14 yd = yb - ya
15 d = math.hypot(xd, yd)
16 if d < 2: return
17 x = xa + xd * 0.5 - yd * 0.5
18 y = ya + xd * 0.5 + yd * 0.5
19 draw.line ([(int(xa), int(ya)),(int(x), int(y))], 255)
20 draw.line ([(int(x), int(y)),(int(xb), int(yb))], 255)
21 c(xa, ya, x, y)
22 c(x, y, xb, yb)
23
24# main
25mx = imgx -1

Callers 1

recipe-577316.pyFile · 0.70

Calls 2

hypotMethod · 0.45
lineMethod · 0.45

Tested by

no test coverage detected