/* Test suite for Mechanics.asy. * * Copyright (C) 2008-2009 W. Trevor King * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ import three; import Mechanics; currentprojection = TopView; real u = 1cm; LabeledCircle lc = LabeledCircle(center=(-2u, 1u)); lc.draw(); lc.label = "a"; lc.center = (-2u, 0.5u); lc.draw(); lc.draw_label(Label("e", align=E)); lc.center = (-2u, 0); lc.label.align = W; lc.draw(); lc.draw_label("b"); lc.draw_label(Label("c", align=E)); lc.draw_label(rotate(90)*Label("e------I", align=S)); lc.draw_label(rotate(45)*Label("e------I", align=S)); lc.center = (-2u, -2u); lc.radius = u/2; lc.label.align = E; lc.draw(); lc.center = (-2u, -3u); lc.label.align = E; lc.draw(); Mass a = Mass(center=(0,0)); Mass b = Mass(center=(2u,1u), Label("$m_b$", align=N)); Mass c = Mass(center=(1u,-2u), Label("$m_c$", align=E)); Mass ms[] = {a, b, c}; Distance dab = Distance(a.center(), b.center(), scale=u, L=Label("$r_{ab}$", align=N, embed=Shift)); Distance dac = Distance(a.center(), c.center(), scale=u, L=Label("$r_{ac}$", align=RightSide)); Distance ds[] = {dab, dac}; Angle bac1 = Angle( b.center(), a.center(), c.center(), radius=.7u, fill=red, L="$\theta_T'$"); Angle bac2 = Angle( b.center(), a.center(), c.center(), radius=-.5u, L="$\theta_T$"); Angle bac3 = Angle( b.center(), a.center(), c.center(), radius=1.5u, L=Label("$\theta_T''$", position=Relative(0.3))); Angle as[] = {bac1, bac2, bac3}; Vector vs[]; draw_ijhat((-u, 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, Label("60dg OOP", position=EndPoint))); for (int i=0; i