From: W. Trevor King Date: Thu, 12 Apr 2012 00:37:14 +0000 (-0400) Subject: Add pChargePen and other charge-fill pens to ElectroMag.asy. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fbc3a9261537db2c1580908f0c5307cd827c7b64;p=course.git Add pChargePen and other charge-fill pens to ElectroMag.asy. --- diff --git a/asymptote/ElectroMag.asy b/asymptote/ElectroMag.asy index 2a78182..52d6dd1 100644 --- a/asymptote/ElectroMag.asy +++ b/asymptote/ElectroMag.asy @@ -23,13 +23,17 @@ import Mechanics; // ---------------------- Charges ------------------------- +pen pChargePen = red; +pen nChargePen = blue; +pen neutralChargePen = grey; + // charged particle struct Charge { LabeledCircle lc; real q; void operator init(pair center=(0,0), real q=1, real radius=2mm, - pen outline=currentpen, pen fill=red, Label L="") { + pen outline=currentpen, pen fill=pChargePen, Label L="") { this.lc.operator init(center=center, radius=radius, outline=outline, fill=fill, L=L); this.q = q; @@ -44,24 +48,24 @@ struct Charge { Charge pCharge(pair center=(0,0), real q=1, real radius=2mm, pen outline=currentpen, Label L="") { - return Charge(center=center, q=q, radius=radius, outline=outline, fill=red, - L=L); + return Charge(center=center, q=q, radius=radius, outline=outline, + fill=pChargePen, L=L); } // negative charge Charge nCharge(pair center=(0,0), real q=-1, real radius=2mm, pen outline=currentpen, Label L="") { - return Charge(center=center, q=q, radius=radius, outline=outline, fill=blue, - L=L); + return Charge(center=center, q=q, radius=radius, outline=outline, + fill=nChargePen, L=L); } // neutral charge Charge neutralCharge(pair center=(0,0), real radius=2mm, pen outline=currentpen, Label L="") { - return Charge(center=center, q=0, radius=radius, outline=outline, fill=grey, - L=L); + return Charge(center=center, q=0, radius=radius, outline=outline, + fill=neutralChargePen, L=L); } // auto-signed charge