From: W. Trevor King Date: Fri, 27 May 2011 15:43:50 +0000 (-0400) Subject: Add Current() and pull out special pens in ElectroMag. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=add68c89981cc325018fa8cf5e1632c74b1f8e33;p=course.git Add Current() and pull out special pens in ElectroMag. --- diff --git a/asymptote/ElectroMag-test.asy b/asymptote/ElectroMag-test.asy index c37c9cb..c2f5c0c 100644 --- a/asymptote/ElectroMag-test.asy +++ b/asymptote/ElectroMag-test.asy @@ -51,5 +51,8 @@ Vector v = EField(a.center, mag=u/2, dir=0,L="E"); v.draw(); Vector v = BField(a.center, mag=u/2, dir=90,L="B"); v.draw(); Vector v = Velocity(a.center, mag=u/2, dir=180,L="$v$"); v.draw(); +Vector Ic = Current(center=(-0.7u, 2.2u), phi=90, L="$I$"); Ic.draw(); +draw(shift(Ic.center)*scale(16pt)*unitcircle, BFieldPen, ArcArrow); + a = aCharge(center=(-3u, 2u), q=-1); a.draw(); diff --git a/asymptote/ElectroMag.asy b/asymptote/ElectroMag.asy index 7dd7b2e..2efcb93 100644 --- a/asymptote/ElectroMag.asy +++ b/asymptote/ElectroMag.asy @@ -20,6 +20,7 @@ import geometry; import Mechanics; + // ---------------------- Charges ------------------------- // charged particle @@ -91,17 +92,27 @@ Charge aCharge(pair center=(0,0), real q=1, real radius=2mm, pen outline=current // ---------------------- Vectors ------------------------- +pen EFieldPen = rgb(1,0.5,0.2); // orange +pen BFieldPen = rgb(0.1,1,0.2); // green +pen CurrentPen = rgb(0.8,0.1,0.8); // purple + // electric field Vector EField(pair center=(0,0), real mag=5mm, real dir=0, real phi=0, Label L="") { - Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=rgb(1,0.5,0.2)); // orange + Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=EFieldPen); return v; } // magnetic field Vector BField(pair center=(0,0), real mag=5mm, real dir=0, real phi=0, Label L="") { - Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=rgb(0.1,1,0.2)); // green + Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=BFieldPen); + return v; +} + +Vector Current(pair center=(0,0), real mag=5mm, real dir=0, real phi=0, Label L="") +{ + Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=CurrentPen); return v; }