1 /** This file is part of Shapes.
3 ** Shapes is free software: you can redistribute it and/or modify
4 ** it under the terms of the GNU General Public License as published by
5 ** the Free Software Foundation, either version 3 of the License, or
8 ** Shapes is distributed in the hope that it will be useful,
9 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
10 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 ** GNU General Public License for more details.
13 ** You should have received a copy of the GNU General Public License
14 ** along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 ** Copyright 2008, 2010, 2014 Henrik Tidefelt
19 ##needs ..Applications..Blockdraw
22 ##lookin ..Shapes..Geometry
23 ##lookin ..Applications..Blockdraw
34 armStyle: Traits..@width:1bp
35 angleStyle: Traits..@width:0.3bp
36 helperStyle: angleStyle & Traits..@dash:[Traits..dashpattern 2bp 2bp]
37 forceStyle: Traits..@width:0.6bp
39 angleHead: Graphics..ShapesArrow
40 forceHead: [Graphics..ShapesArrow width:1.5mm rearAngle:180° ...]
43 ** Of course, the hinge is at the origin.
47 z0: (0mm,0mm) |** Hinge
48 z1: z0 + r1*[dir ~90°+theta1] |** Center of first mass
49 z1r: z0 + hExtend*r1*[dir ~90°] |** Reference position of first mass
50 z2: z1 + r2*[dir ~90°+theta1+theta2] |** Center of second mass
51 z2r: z1 + hExtend*r2*[dir ~90°]
52 z2rr: z1 + hExtend*r2*[dir ~90°+theta1]
55 IO..•page << Traits..@width:1mm | [[shift (0,0.5*Traits..@width)] [Graphics..stroke (~1cm,0)--(1cm,0)]]
59 IO..•page << armStyle | [Graphics..stroke z0--z1--z2]
60 IO..•page << helperStyle | [Graphics..stroke z0--z1r]
61 << helperStyle | [Graphics..stroke z1--z2r]
62 << helperStyle | [Graphics..stroke z1--z2rr]
63 << armStyle & Traits..@nonstroking:Traits..BW..WHITE | [Graphics..fillstroke [shift z1] [] [Geometry..circle rm1]]
64 << armStyle & Traits..@nonstroking:Traits..BW..WHITE | [Graphics..fillstroke [shift z2] [] [Geometry..circle rm2]]
67 p: [Geometry..ccw_arc z0 z1r z1 15mm]
68 IO..•page << angleStyle | [Graphics..stroke p head:angleHead]
69 IO..•page << [putlabelBelow [Graphics..TeX `$\theta_{1}$´] [Layout..mspoint p 0.5] ~0.5]
73 p: [Geometry..ccw_arc z1 z2r z2rr 17mm]
74 IO..•page << angleStyle | [Graphics..stroke p head:angleHead]
75 IO..•page << [putlabelBelow [Graphics..TeX `$\theta_{1}$´] [Layout..mspoint p 0.5] ~0.5]
79 p: [Geometry..ccw_arc z1 z2rr z2 15mm]
80 IO..•page << angleStyle | [Graphics..stroke p head:angleHead]
81 IO..•page << [putlabelBelow [Graphics..TeX `$\theta_{2}$´] [Layout..mspoint p 0.5] ~0.5]
85 p: [Geometry..ccw_arc z0 1mm*[dir ~150°] 1mm*[dir ~30°] 4mm]
86 IO..•page << angleStyle | [Graphics..stroke p head:angleHead]
87 IO..•page << [putlabelBelow [Graphics..TeX `$\tau$´] [Layout..mspoint p 0 1mm] 0]
92 IO..•page << forceStyle | [Graphics..stroke p head:forceHead]
93 IO..•page << [putlabelLeft [Graphics..TeX `$m_{1} g$´] p.end.p ~1]
98 IO..•page << forceStyle | [Graphics..stroke p head:forceHead]
99 IO..•page << [putlabelLeft [Graphics..TeX `$m_{2} g$´] p.end.p ~1]