summaryrefslogtreecommitdiff
path: root/info/examples/tlc2/Escher.ps
blob: 87e6b36a84f634edffb151fff4bd9e06101d7146 (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
%!
%%BoundingBox: 0 0 236 236
% M. C. Escher style impossible triangle
% written by Guy Shaw

% Things that are easy to play with:
% Position on paper, overall size, and linewidth
/inch { 72 mul } bind def

gsave

.15 inch 0 translate
3 inch dup scale
1 3 inch div setlinewidth

% Thickness parameter:
% /Thick is the thickness of the structural members of the triange,
% as a fraction of the height of the triangle.
% Reasonable looking impossible triangles can be obtained with Thick <= 1/6.
% right at /Thick == 1/6, there is no space left inside the triangle.
% /Thick > 1/6 yields bizarre, but not very interesting results.
% /Thick < 1/20 is less interesting, because the "impossibility"
% is not so striking when the structural members are that thin.
% A good "standard" value is 1/8.

/Thick 1 8 div def

% You would not normally want to change anything that follows.

/Tall 1 def
/HalfThick Thick .5 mul def

newpath
	HalfThick Thick moveto
	Thick  0 lineto
	1 Thick sub  0 lineto
	1 HalfThick sub  Thick lineto
	.5 HalfThick add  Tall Thick sub lineto

	1 Thick sub  0 moveto
	.5 HalfThick add  Tall 3 Thick mul sub lineto
	Thick 3 mul  Thick 2 mul lineto

	1 Thick 2.5 mul sub  Thick moveto
	.5  Tall Thick 4 mul sub lineto
stroke

newpath
	HalfThick Thick moveto
	1 Thick 2.5 mul sub  Thick lineto
	HalfThick neg  Thick rlineto
	Thick Thick add  Thick Thick add lineto
	.5 HalfThick add  Tall Thick sub lineto
	Thick neg  0 rlineto
	closepath
fill
grestore
/Helvetica findfont 30 scalefont setfont
0 5 moveto (L) show
3.1 inch 5 moveto (R) show
1.6 inch 2.7 inch moveto (T) show
showpage