Add Vector.copy(), +, and - to Mechanics.asy.
[course.git] / asymptote / Mechanics-test.asy
index a99f0887eaa1c14a5c11d8109c38563649b8877f..9dc92ec6744deca20209f674779b53f3687c140b 100644 (file)
@@ -62,7 +62,8 @@ vs.push(jhat(center=(0,u)));
 
 vs.push(Vector(center=(-1u,-4u), phi=90, "Out"));
 vs.push(Vector(center=(-1u,-5.5u), phi=-90, "In"));
-vs.push(Vector(center=(0, -4u), mag=1.5u, dir=-90, phi=60, "60dg OOP"));
+vs.push(Vector(center=(0, -4u), mag=1.5u, dir=-90, phi=60,
+               Label("60dg OOP", position=EndPoint)));
 
 for (int i=0; i<as.length; i+=1)
   as[i].draw();
@@ -87,6 +88,16 @@ p.draw(drawVertical=true);
 Surface s = Surface(pFrom=(0,-7u), pTo=(3.5u, -7u), L="Table");
 s.draw();
 
+Vector v1 = Vector((-2u, -7u), Label("$v_1$", align=E, position=EndPoint));
+v1.draw();
+Vector v2 = Vector(v1.center, mag=10mm, dir=90, Label("$v_2$", align=W));
+v2.draw();
+Vector v3 = v1 + v2;
+v3.label = Label("$v_3 = v_1 + v_2$", align=E, position=EndPoint);
+v3.draw();
+Vector v4 = v1 - v2;
+v4.label = Label("$v_4 = v_1 - v_2$", align=S, position=EndPoint);
+v4.draw();
 
 Vector v = Velocity();
 pair vfc = (5u,0);  // vector field center