File: trig.mp

package info (click to toggle)
texlive-base 2020.20210202-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 791,092 kB
  • sloc: perl: 45,038; sh: 4,926; makefile: 4,655; ansic: 2,266; ruby: 2,231; tcl: 2,156; xml: 1,874; python: 822; cpp: 695; awk: 606; lisp: 199; sed: 8
file content (84 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download | duplicates (9)
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
verbatimtex 
\documentclass{article} 
\usepackage{palatino} 
\usepackage{concmath} 
\usepackage{ccfonts} 
\begin{document} 
etex

%prologues := 2;


vardef trigonometry(expr ct)=

	save	z, p, m, pic;
	numeric m;
	pair	z[];
	path	p[];
	picture pic;

	pic := nullpicture;
	m := if (xpart ct) > (ypart ct): ypart ct else: xpart ct fi;

	p0 = unitsquare xscaled (xpart ct) yscaled (ypart ct);
	p3 = origin--ct;
	p2 = (m,0)--(m,m)--(0,m);
	p1 = (m,0){up}..{left}(0,m);

	z0 = origin;
	z2 = point 0 of p2;
	z5 = point 2 of p2;
	z6 = ct;
	z3 = p1 intersectionpoint p3;
	z4 = p2 intersectionpoint p3;
	z1 = (xpart z3, 0);

	p4 = z1--z3;
	m := xpart (p2 intersectiontimes p3);
	if m <= 1:
		p5 = z2--z4;
		p6 = z5--z6;
	else:
		p5 = z5--z4;
		p6 = z2--z6;
	fi;

	m := top(0)-bot(0);

	for i=0 upto 4:	
		addto pic doublepath p[i] withpen pencircle scaled (m/3);
	endfor;
	for i=3 upto 6:	
		addto pic doublepath p[i] withpen pencircle scaled m;	
	endfor;

	for i=0 upto 6:	
		addto pic doublepath z[i] withpen pencircle scaled 3m;	
	endfor;

	addto pic also thelabel.llft(btex \strut $a$ etex , z0);
	addto pic also thelabel.bot(btex \strut $b$ etex, z1);
	addto pic also thelabel.bot(btex \strut $c$ etex, z2);
	addto pic also thelabel.lft(btex $d$ etex, z3);
	addto pic also thelabel.ulft(btex $e$ etex, z4);
	addto pic also thelabel.lft(btex \strut $f$ etex, z5);
	addto pic also thelabel.rt(btex \strut $g$ etex, z6);

	pic
enddef;




beginfig(1);

pickup pencircle scaled .6pt;

draw trigonometry((6cm,3cm));
draw trigonometry((3cm,6cm))shifted (7cm,0);

endfig;
verbatimtex 
\end{document} 
etex
end