From: W. Trevor King Date: Wed, 12 Aug 2009 08:58:09 +0000 (-0400) Subject: Added out-of-plane vectors to Mechanics.asy. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=32e8e922da6f5a20ff88934672c1ce1177b912de;p=course.git Added out-of-plane vectors to Mechanics.asy. And associated tests to Mechanics-test.asy. --- diff --git a/asymptote/Mechanics-test.asy b/asymptote/Mechanics-test.asy index e3843e1..acbc701 100644 --- a/asymptote/Mechanics-test.asy +++ b/asymptote/Mechanics-test.asy @@ -36,6 +36,10 @@ Vector vs[]; vs.push(ihat(center=(0,u))); 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")); + for (int i=0; i this.out_of_plane_tolerance) { + // draw arrow in the plane of the drawing + // TODO: thickening for phi? + p = this.mag*Cos(this.phi)*dir(this.dir); + path P = (0,0)--p; + draw(picF, P, outline, Arrow); + if (rotateLabel == true) + label_rotate = p; + label_align = unit(rotate(90)*p); + } else if (phi_e > 0 && phi_e < 180) { + // draw a circled dot for out-of-the-page + p = (0, this.out_of_plane_radius); + draw(picF, scale(this.out_of_plane_radius)*unitcircle, outline); + dot(picF, (0,0), outline); + } else { + // draw a circled cross for into-the-page + real a = 0.8*sqrt(2.0)/2.0; + p = (0, this.out_of_plane_radius); + draw(picF, scale(this.out_of_plane_radius)*unitcircle, outline); + draw(picF, scale(this.out_of_plane_radius)*((-a,-a)--(a,a)), outline); + draw(picF, scale(this.out_of_plane_radius)*((-a,a)--(a,-a)), outline); + } label(pic = picF, L = rotate(degrees(label_rotate)) * L, position = p+labelOffset, - align = unit(rotate(90)*p)); + align = label_align); add(pic, picF, center); } }