MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / add_arrowed_line

Function add_arrowed_line

PythonAPI/examples/microsim.py:50–65  ·  view source on GitHub ↗
(start, end, **args)

Source from the content-addressed store, hash-verified

48 return [coord.x, coord.y]
49
50 def add_arrowed_line(start, end, **args):
51 direction = (end - start).make_unit_vector()
52 normal = direction.rotate(math.pi / 2)
53 mid = (start + end) / 2
54 dwg.add(dwg.line(
55 to_svg(start),
56 to_svg(end),
57 **args))
58 dwg.add(dwg.line(
59 to_svg(mid - 0.75 * direction + 0.75 * normal),
60 to_svg(mid + 0.75 * direction),
61 **args))
62 dwg.add(dwg.line(
63 to_svg(mid - 0.75 * direction - 0.75 * normal),
64 to_svg(mid + 0.75 * direction),
65 **args))
66
67 def add_line(start, end, **args):
68 dwg.add(dwg.line(

Callers 1

microsim.pyFile · 0.85

Calls 3

to_svgFunction · 0.85
rotateMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected