summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/metapost/featpost/example/standard/fis1prex.mp
blob: cff9d672d88ef269df44ad1f9953f02055f97f2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
% fis1prex.mp
% L. Nobre G. 
% 2003

%input featpost3Dplus2D;

verbatimtex
\documentclass{article}
\usepackage{beton}
\usepackage{concmath}
\usepackage{ccfonts}
\begin{document}
etex

beginfig(1); 						
	numeric largtecto, molasfrac, altutecto, compcorda, espetecto;
	numeric largmolas, largnum, cordafrac, espesfrac, largmolfr;
	numeric u, alpha, i, numturns, alphafrac, alpharadi, rcf, rcd;
	pen mainp, auxip;
	path leftspr, rightsp, corda, boxtecto, traco, linhalpha, rcp;
	pair esqutecto, diretecto, esquemola, direimola, espessvec;
	largnum = 100;
	u = 1mm;
	molasfrac = 0.8;
	espesfrac = 0.1;
	cordafrac = 0.3;
	alphafrac = 0.3;
	largmolfr = 0.12;
	rcf = 0.1;
	numturns = 11;
	alpha = 120;
	mainp = pencircle scaled 0.4u;
	auxip = pencircle scaled 0.2u;
	largtecto = largnum*u;
	rcd = rcf*largtecto;
	largmolas = largmolfr*molasfrac*largtecto;
	compcorda = cordafrac*largtecto;
	espetecto = espesfrac*largtecto;
	altutecto = 0.5*largtecto*molasfrac*cosd(alpha/2)/sind(alpha/2);
	alpharadi = 2*alphafrac*altutecto;
	esqutecto = (-largtecto/2,altutecto);
	diretecto = (largtecto/2,altutecto);
	esquemola = (-largtecto*molasfrac/2,altutecto);
	direimola = (largtecto*molasfrac/2,altutecto);
	espessvec = (0,espetecto);
	boxtecto = esqutecto--
		   diretecto--
		  (diretecto+espessvec)--
		  (esqutecto+espessvec)--cycle;
	traco = (origin--(dir(45))) scaled 6in;
	for i=-largnum upto largnum:
		draw traco shifted (2*i*u,0) withpen auxip;
	endfor;
	clip currentpicture to boxtecto;
	pickup mainp;
	draw esqutecto--diretecto;
	leftspr = springpath(direimola,origin,numturns,largmolas,0.55);
	rightsp = springpath(origin,esquemola,numturns,largmolas,0.55);
	draw leftspr;
	draw rightsp;
	rcp = randomcirc( rcd, 0.1*rcd, 180 ) shifted (0,-compcorda);
	draw rcp;
	draw origin--(0,-compcorda) cutafter rcp;
	linhalpha = fullcircle scaled alpharadi;
	linhalpha := linhalpha cutafter rightsp;
	linhalpha := linhalpha cutbefore leftspr;
	draw linhalpha withpen auxip;
	label(btex m etex scaled 3, (0,-compcorda) );
	label.urt(btex $\alpha$ etex scaled 3, (0,alpharadi/2) );
endfig;

beginfig(2);
  numeric u, basesize, baseheight, alphang, thetang, sfearsize;
  numeric armsize, marginraise, totalraise, axeray, cardansize;
  color basepos, tdorigin, oneaxe, otheraxe, rotaxbascenter, axedir;
  color gluaxbascenter, rotrajcenter, cardanpos, refpoint, anotheraxe;
  color armdir, armbasonepos, armbastwopos, sfearpos;
  path glueaxebase, rotataxebase, rotrajector, axepath, sfearpath;
  numeric armray;
  u = 0.0125mm;
  basesize = 30u;
  baseheight = 3u;
  alphang = 20;
  thetang = -18;
  armsize = 25u;
  marginraise = 6u;
  axeray = 3u;
  cardansize = 3u;
  sfearsize = 4u;
  armray = 1.5u;
  totalraise = armsize*sind(alphang)+marginraise+cardansize*cosd(alphang);
  basepos = (0,0,-0.5baseheight);
  f := -2*(-2basesize,-basesize,-5baseheight);
  kindofcube(false, false, basepos, 0, 0, 0, 2basesize, 2basesize, baseheight );
  tdorigin = (0,0,0);
  oneaxe = (0,axeray/cosd(alphang),0);
  otheraxe = (1,0,0);
  anotheraxe = (0,cosd(alphang),-sind(alphang));
  gluaxbascenter = tdorigin - (0,totalraise*sind(alphang),0);
  glueaxebase = ellipticpath( gluaxbascenter, oneaxe, axeray*otheraxe );
  axedir = (0,sind(alphang),cosd(alphang));
  rotrajcenter = (0,0,totalraise);
  rotaxbascenter = rotrajcenter-axedir*cardansize;
  refpoint = rotrajcenter+axedir*cardansize;
  rotataxebase = rigorouscircle( rotaxbascenter, axedir, axeray );
  rotrajector = rigorouscircle( rotrajcenter, axedir, armsize );
  axepath = twocyclestogether( glueaxebase, rotataxebase );
  fill axepath withcolor background;
  draw axepath;
  draw rotataxebase;
  drawarrow subpath (3,10.5) of rotrajector dashed evenly;
%  dotlabel.top( btex 1 etex, point 1 of rotrajector );
%  dotlabel.top( btex 5 etex, point 5 of rotrajector );
%  dotlabel.top( btex 3 etex, point 3 of rotrajector );
  kindofcube(false,false,rotrajcenter,90,90-alphang,thetang,2cardansize,2cardansize,2cardansize);
  draw rp(refpoint);
  armdir := otheraxe*cosd(thetang)+anotheraxe*sind(thetang);
  armbasonepos = rotrajcenter + cardansize*armdir;
  armbastwopos = rotrajcenter + (armsize-sfearsize)*armdir; % NOT RIGOROUS
  sfearpos = rotrajcenter + armsize*armdir;
  rigorousdisc( 0, true, armbasonepos, armray, armbastwopos-armbasonepos );
  sfearpath = rigorousfearpath( sfearpos, sfearsize );
  fill sfearpath withcolor background;
  draw sfearpath;
endfig;

verbatimtex
\end{document}
etex

end;