chiark / gitweb /
visdebug: make circle of variable size
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Dec 2017 13:01:01 +0000 (13:01 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 30 Dec 2017 13:01:02 +0000 (13:01 +0000)
Existing arrows have their circle sizes adjusted according to the
lengths of the arrows.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
visual

diff --git a/visual b/visual
index 490a4b96252f4fecf90a7e220f3b11991527fd49..f0b9b49be253e60d5fc15507f11a86cdde57475a 100755 (executable)
--- a/visual
+++ b/visual
@@ -27,14 +27,14 @@ class Visdebug(BaseVisdebug):
     #dbg('Visdebug', ps)
     curve(pos = ps, color=color)
   def circle(vd, c, axis, **kw):
-    ring(pos=c, axis=axis, radius=0.25, thickness=0.005, **kw)
+    ring(pos=c, axis=axis, radius=np.linalg.norm(axis), thickness=0.005, **kw)
   def arrow(vd, p, d, **kw):
     print('arrow %s' % repr(kw), file=sys.stderr)
     bodge_color = kw.get('color', (1,0,0))
     try: del kw['color']
     except KeyError: pass
     vd.line(p, p+d, color=bodge_color, **kw)
-    vd.circle(p, d, color=bodge_color, **kw)
+    vd.circle(p, np.asarray(d) * 0.25, color=bodge_color, **kw)
   def crashing(vd, msg):
     print("CRASHING - VISDEBUG", msg, file=sys.stderr)
     rate(1E-8)