From 663d2cc1dea88109e4ab15da910936553d36a9a3 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 12 Aug 2009 05:53:43 -0400 Subject: [PATCH] Rearranged TwoTerminal generator args beg,type,ang -> beg,ang,type. That way the positioning arguments are together. Also fixed typo in resistor default angle. --- asymptote/Circ-test.asy | 40 ++++++++++++++++++++-------------------- asymptote/Circ.asy | 12 ++++++------ 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/asymptote/Circ-test.asy b/asymptote/Circ-test.asy index f36dc04..309dacc 100644 --- a/asymptote/Circ-test.asy +++ b/asymptote/Circ-test.asy @@ -22,29 +22,29 @@ import Circ; real u = 2cm, v=0; write("resistor"); -TwoTerminal Rn = resistor((0,v), normal, 0, "$R_{normal}$", "30\ohm"); +TwoTerminal Rn = resistor((0,v), 0, normal, "$R_{normal}$", "30\ohm"); dot("beg", Rn.beg, NW); dot("end", Rn.end, NE); dot("mid", Rn.mid, S); -TwoTerminal Rvb = resistor((2u,v), variable, 0, "$R_{variable}$", "30\kohm"); +TwoTerminal Rvb = resistor((2u,v), 0, variable, "$R_{variable}$", "30\kohm"); v -= u; write("capacitor"); -TwoTerminal Cn = capacitor((0,v), normal, 0, "$C_{normal}$", "30 $\mu$F"); -TwoTerminal Ce = capacitor((u,v), electrolytic, 0, "$C_{electrolytic}$", "30 $\mu$F"); -TwoTerminal Cvb = capacitor((2u,v), variable, 0, "$C_{variable}$", "30 $\mu$F"); -TwoTerminal Cvt = capacitor((3u,v), variant, 0, "$C_{variant}$", "30 $\mu$F"); +TwoTerminal Cn = capacitor((0,v), 0, normal, "$C_{normal}$", "30 $\mu$F"); +TwoTerminal Ce = capacitor((u,v), 0, electrolytic, "$C_{electrolytic}$", "30 $\mu$F"); +TwoTerminal Cvb = capacitor((2u,v), 0, variable, "$C_{variable}$", "30 $\mu$F"); +TwoTerminal Cvt = capacitor((3u,v), 0, variant, "$C_{variant}$", "30 $\mu$F"); v -= u; write("inductor"); -TwoTerminal Lup = inductor((0,v), Up, 0, "$L_{Up}$", "30 H"); -TwoTerminal Ldown = inductor((u,v), Down, 0, "$L_{Down}$", "30 H"); +TwoTerminal Lup = inductor((0,v), 0, Up, "$L_{Up}$", "30 H"); +TwoTerminal Ldown = inductor((u,v), 0, Down, "$L_{Down}$", "30 H"); v -= u; write("diode"); -TwoTerminal Dn = diode((0,v), normal, 0, "$D_{normal}$", "1.3 V"); -TwoTerminal Dz = diode((u,v), zener, 0, "$D_{zener}$", "1.3 V"); -TwoTerminal Dled = diode((2u,v), LED, 0, "$D_{LED}$", "1.7 V"); +TwoTerminal Dn = diode((0,v), 0, normal, "$D_{normal}$", "1.3 V"); +TwoTerminal Dz = diode((u,v), 0, zener, "$D_{zener}$", "1.3 V"); +TwoTerminal Dled = diode((2u,v), 0, LED, "$D_{LED}$", "1.7 V"); v -= u; write("battery"); @@ -52,8 +52,8 @@ TwoTerminal B = battery((0,v), 0, "Battery", "1.5 V"); v -= u; write("switch"); -TwoTerminal B = switchSPST((0,v), NO, 0, "$S_{NO}$", "Open"); -TwoTerminal B = switchSPST((u,v), NC, 0, "$S_{NC}$", "Closed"); +TwoTerminal B = switchSPST((0,v), 0, NO, "$S_{NO}$", "Open"); +TwoTerminal B = switchSPST((u,v), 0, NC, "$S_{NC}$", "Closed"); v -= u; write("current"); @@ -61,22 +61,22 @@ TwoTerminal Icurr = current((0,v), 0, "I", "10 A"); v -= u; write("source"); -TwoTerminal Sdc = source((0,v), DC, 0, "DC", "5 V"); -TwoTerminal Sac = source((u,v), AC, 0, "AC", "5 V$_{pp}$"); -TwoTerminal Si = source((2u,v), I, 0, "I", "5 A"); -TwoTerminal Sv = source((3u,v), V, 0, "V", "5 V"); +TwoTerminal Sdc = source((0,v), 0, DC, "DC", "5 V"); +TwoTerminal Sac = source((u,v), 0, AC, "AC", "5 V$_{pp}$"); +TwoTerminal Si = source((2u,v), 0, I, "I", "5 A"); +TwoTerminal Sv = source((3u,v), 0, V, "V", "5 V"); v -= 1.5u; write("positioning"); -TwoTerminal Spos = source((u,v), DC, 90, "DC", "5 V"); -TwoTerminal Rpos = resistor((0,0), normal, 0, "+offset", "5 \ohm", draw=false); +TwoTerminal Spos = source((u,v), 90, DC, "DC", "5 V"); +TwoTerminal Rpos = resistor((0,0), 0, normal, "+offset", "5 \ohm", draw=false); Rpos.centerto(Spos.beg, Spos.end, offset=u); Rpos.draw(); dot("Sa", Spos.beg, S); dot("Sb", Spos.end, N); dot("Ra", Rpos.beg, S); dot("Rb", Rpos.end, N); -TwoTerminal Cpos = capacitor((0,0), normal, 0, "-2offset", "4 F",draw=false); +TwoTerminal Cpos = capacitor((0,0), 0, normal, "-2offset", "4 F",draw=false); Cpos.centerto(Spos.beg, Spos.end, offset=-2u); Cpos.draw(); v -= u; diff --git a/asymptote/Circ.asy b/asymptote/Circ.asy index 191948c..268f39f 100644 --- a/asymptote/Circ.asy +++ b/asymptote/Circ.asy @@ -269,7 +269,7 @@ struct TwoTerminal { real rstlth=2mm; int normal=0, variable=2; -TwoTerminal resistor(pair beg=(0,0), int type=normal, real ang=(0,0), +TwoTerminal resistor(pair beg=(0,0), real ang=0, int type=normal, string name="", string val="", bool draw=true) { path pLine, pMisc[]={}; @@ -299,7 +299,7 @@ TwoTerminal resistor(pair beg=(0,0), int type=normal, real ang=(0,0), real coil=2mm; int Up=0, Down=1; -TwoTerminal inductor(pair beg=(0,0), int type=Up, real ang=0, string name="", +TwoTerminal inductor(pair beg=(0,0), real ang=0, int type=Up, string name="", string val="", bool draw=true) { path pLine; @@ -331,7 +331,7 @@ TwoTerminal inductor(pair beg=(0,0), int type=Up, real ang=0, string name="", real platsep=1mm; int normal=0, electrolytic=1, variable=2, variant=3; -TwoTerminal capacitor(pair beg=(0,0), int type=normal, real ang=0, +TwoTerminal capacitor(pair beg=(0,0), real ang=0, int type=normal, string name="", string val="", bool draw=true) { path pLine[]={}, pMisc[]={}; @@ -373,7 +373,7 @@ int zener=1, LED=2; // capacitors) are also polarized. The positioning method centerto(), // provides enough flexibility. -TwoTerminal diode(pair beg=(0,0), int type=normal, real ang=0, string name="", +TwoTerminal diode(pair beg=(0,0), real ang=0, int type=normal, string name="", string val="", bool draw=true) { path pLine[]={}, pMisc[]={}; @@ -441,7 +441,7 @@ real ssep=3mm, swt=1.2ssep; // TODO remove swt? /* `switch' is a Asymptote keyword (or it should be), so append SPST * for Single Pole Single Throw. */ -TwoTerminal switchSPST(pair beg=(0,0), int type=NO, real ang=0, string name="", +TwoTerminal switchSPST(pair beg=(0,0), real ang=0, int type=NO, string name="", string val="", bool draw=true) { path pLine[]={}, pMisc[]={}; @@ -491,7 +491,7 @@ TwoTerminal current(pair beg=(0,0), real ang=0, string name="", string val="", real ssize=6mm; int AC=0,DC=1,I=2,V=3; -TwoTerminal source(pair beg=(0,0), int type=AC, real ang=0, string name="", +TwoTerminal source(pair beg=(0,0), real ang=0, int type=AC, string name="", string val="", bool draw=true) { path pLine[]={}, pMisc[]={}; -- 2.26.2