From fbc3a9261537db2c1580908f0c5307cd827c7b64 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 11 Apr 2012 20:37:14 -0400 Subject: [PATCH] Add pChargePen and other charge-fill pens to ElectroMag.asy. --- asymptote/ElectroMag.asy | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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 -- 2.26.2