Combined Circ.wire() and Circ.wireU().
[course.git] / asymptote / Circ.asy
index f78507e1393fcc9b18d33ee93e477a271b600b07..86dfd1e68f35b5350e367a107ef2ff27e3bac695 100644 (file)
@@ -84,33 +84,30 @@ path txtahead (path p)
 
 // function to wire the symbols together
 
-int nsq=0, udsq=2, rlsq=3, usq=4;
+int nsq=0, udsq=2, rlsq=3;
 
-void wire(pair pin_beg, pair pin_end, int type)
+void wire(pair pin_beg, pair pin_end, int type=nsq, real dist=0)
 {
-  if (type==nsq) {
-    draw(pin_beg--pin_end, line);
-  } else if (type==udsq) {
-    draw(pin_beg--(pin_beg.x,pin_end.y)--pin_end, line);
-  } else if (type==rlsq) {
-    draw(pin_beg--(pin_end.x,pin_beg.y)--pin_end, line);
-  } else {
-    write("Error, unrecognized wire type",type);
-  }
-}
-
-// function to connect two branches in parallel
-
-void wireU(pair pin_beg, pair pin_end, real dist, int type)
-{
-  if (type==udsq) {
-    draw(pin_beg--(pin_beg+(0,dist))--(pin_end.x,pin_beg.y + dist)
-        --pin_end, line);
-  } else if (type==rlsq) {
-    draw(pin_beg--(pin_beg+(dist,0))--(pin_beg.x + dist,pin_end.y)
-        --pin_end, line);
+  if (dist == 0) {
+    if (type==nsq) {
+      draw(pin_beg--pin_end, line);
+    } else if (type==udsq) {
+      draw(pin_beg--(pin_beg.x,pin_end.y)--pin_end, line);
+    } else if (type==rlsq) {
+      draw(pin_beg--(pin_end.x,pin_beg.y)--pin_end, line);
+    } else {
+      write("Error, unrecognized wire type ",type);
+    }
   } else {
-    write("Error, unrecognized wireU type",type);
+    if (type==udsq) {
+      draw(pin_beg--(pin_beg+(0,dist))--(pin_end.x,pin_beg.y + dist)
+          --pin_end, line);
+    } else if (type==rlsq) {
+      draw(pin_beg--(pin_beg+(dist,0))--(pin_beg.x + dist,pin_end.y)
+          --pin_end, line);
+    } else {
+      write("Error, unrecognized wireU type",type);
+    }
   }
 }