From 32e8e922da6f5a20ff88934672c1ce1177b912de Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 12 Aug 2009 04:58:09 -0400 Subject: [PATCH] Added out-of-plane vectors to Mechanics.asy. And associated tests to Mechanics-test.asy. --- asymptote/Mechanics-test.asy | 4 +++ asymptote/Mechanics.asy | 47 ++++++++++++++++++++++++++++-------- 2 files changed, 41 insertions(+), 10 deletions(-) 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); } } -- 2.26.2