// ---------------------- Vectors -------------------------
// electric field
-Vector EField(pair center=(0,0), real mag=5mm, real dir=0, Label L="")
+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, L=L, outline=rgb(1,0.5,0.2)); // orange
+ Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=rgb(1,0.5,0.2)); // orange
return v;
}
// magnetic field
-Vector BField(pair center=(0,0), real mag=5mm, real dir=0, Label L="")
+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, L=L, outline=rgb(0.1,1,0.2)); // green
+ Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=rgb(0.1,1,0.2)); // green
return v;
}
}
}
-Vector Velocity(pair center=(0,0), real mag=5mm, real dir=0, Label L="")
+Vector Velocity(pair center=(0,0), real mag=5mm, real dir=0, real phi=0, Label L="")
{
- Vector v = Vector(center=center, mag=mag, dir=dir, L=L, outline=rgb(1,0.1,0.2)); // red
+ Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=rgb(1,0.1,0.2)); // red
return v;
}
// ---------------------- Forces -------------------------
-Vector Force(pair center=(0,0), real mag=5mm, real dir=0, Label L="")
+Vector Force(pair center=(0,0), real mag=5mm, real dir=0, real phi=0, Label L="")
{
- Vector v = Vector(center=center, mag=mag, dir=dir, L=L, outline=rgb(0.1,0.2,1)); // blue
+ Vector v = Vector(center=center, mag=mag, dir=dir, phi=phi, L=L, outline=rgb(0.1,0.2,1)); // blue
return v;
}
}
}
-Vector hatVect (string name, pair center=(0,0), real dir=0) {
+Vector hatVect (string name, pair center=(0,0), real dir=0, real phi=0) {
string L = replace("$\mathbf{\hat{X}}$", "X", name);
- Vector v = Vector(center=center, mag=5mm, dir=dir, L=L, outline=rgb(0,0,0));
+ Vector v = Vector(center=center, mag=5mm, dir=dir, phi=phi, L=L, outline=rgb(0,0,0));
return v;
}
-Vector ihat (pair center=(0,0), real dir=0) {
- Vector v = hatVect(name="i", center=center, dir=dir);
+Vector ihat (pair center=(0,0), real dir=0, real phi=0) {
+ Vector v = hatVect(name="i", center=center, dir=dir, phi=phi);
return v;
}
-Vector jhat (pair center=(0,0), real dir=90) {
- Vector v = hatVect(name="j", center=center, dir=dir);
+Vector jhat (pair center=(0,0), real dir=90, real phi=0) {
+ Vector v = hatVect(name="j", center=center, dir=dir, phi=phi);
return v;
}