Cpos.centerto(Spos.beg, Spos.end, offset=-2u);
Cpos.draw();
v -= u;
+
+write("wires");
+dot("nsq", (0,v), N);
+dot("b", (u/2,v-u/2), S);
+wire((0,v), (u/2,v-u/2), nsq);
+dot("udsq", (u,v), N);
+dot("b", (3u/2,v-u/2), S);
+wire((u,v), (3u/2,v-u/2), udsq);
+dot("rlsq", (2u,v), N);
+dot("b", (5u/2,v-u/2), S);
+wire((2u,v), (5u/2,v-u/2), rlsq);
+dot("udsq w/d", (3u,v), N);
+dot("b", (7u/2,v-u/2), S);
+wire((3u,v), (7u/2,v-u/2), udsq, -u/4);
+dot("rlsq w/d", (4u,v), N);
+dot("b", (9u/2,v-u/2), S);
+wire((4u,v), (9u/2,v-u/2), rlsq, u/4);
+v -= u;
// 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);
+ }
}
}