Skip to content

Instantly share code, notes, and snippets.

@Hermann-SW
Created May 15, 2022 13:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hermann-SW/c5151eddcb8a1271fc5a539e57a1f869 to your computer and use it in GitHub Desktop.
Save Hermann-SW/c5151eddcb8a1271fc5a539e57a1f869 to your computer and use it in GitHub Desktop.
Determination of pentagon fold angle for C60 fullerene (truncated icosahedron)
%!
0 setlinewidth
/vertex { 2 copy 5 4 roll dup 4 1 roll
newpath 0 360 arc closepath
gsave 1.0 setgray fill grestore
stroke
12 ge {
newpath moveto
gsave dup false charpath flattenpath pathbbox grestore
exch 4 1 roll exch sub -.5 mul 3 1 roll sub -.5 mul exch
rmoveto show
} { pop pop pop } ifelse
} def
/txt {
newpath moveto
gsave dup false charpath flattenpath pathbbox grestore
exch 4 1 roll exch sub -.5 mul 3 1 roll sub -.5 mul exch
rmoveto show
} def
/txtdistdeg {
newpath moveto
gsave dup false charpath flattenpath pathbbox grestore
exch 4 1 roll exch sub -.5 mul 3 1 roll sub -.5 mul exch
5 3 roll gsave
rotate 0 exch rmoveto
rmoveto show
grestore
} def
/poly {
newpath
moveto
{
count 0 eq { exit } if
lineto
} loop
} def
%% http://computer-programming-forum.com/36-postscript/3d1b79b93a578811.htm
/arrow %% angle /arrow -- draws arrowhead
{
gsave
currentpoint translate 90 sub rotate .5 .5 scale
newpath
0.1 setlinewidth
0 -15 moveto
-6 -18 lineto
-4 -15 -1 -9 0 0 curveto
1 -9 4 -15 6 -18 curveto
0 -15 lineto
fill
grestore
} def
/arrowto %% x1 y1 arrowto -- draws line with arrowhead
{
2 copy % x1 y1 x1 y1
currentpoint % x1 y1 x1 y1 x0 y0
3 -1 roll exch % x1 y1 x1 x0 y1 y0
sub % x1 y1 x1 x0 y1-y0
3 1 roll % x1 y1 y1-y0 x1 x0
sub % x1 y1 y1-y0 x1-x0
atan % x1 y1 theta
3 1 roll % theta x1 y1
2 copy lineto % theta x1 y1
2 copy stroke moveto % theta x1 y1
3 -1 roll arrow % x1 y1
moveto
} def
/rarrowto { %% dx dy rarrowto --
exch currentpoint % dy dx x0 y0
4 1 roll % y0 dy dx x0
add 3 1 roll % x0+dx y0 dy
add arrowto
} def
%% len dist cr cg cb angle x1 y1
/parrow {
gsave
newpath translate 0 0 moveto
rotate
setrgbcolor
0 exch rmoveto
0 rarrowto
grestore
} def
% .75 setgray 300 400 200 400 200 300 275 325 poly fill
% (txt) 350 250 txt
% () 0.3 390 270 vertex
300 400 translate
gsave
50 -35 0 0 1 -90 0 230 parrow
50 35 0 0 1 -90 0 230 parrow
50 -35 0 0 1 0 -260 0 parrow
50 -105 0 0 1 0 -260 0 parrow
50 35 0 0 1 180 260 0 parrow
50 105 0 0 1 180 260 0 parrow
grestore
150 150 scale
0.75 setgray
newpath -3 0 moveto 3 0 lineto stroke
newpath 0 -3 moveto 0 3 lineto stroke
0.01 setlinewidth
/Times-Roman findfont 0.12 scalefont setfont
gsave
1 0 0 setrgbcolor
newpath 0 0 moveto
36 rotate 1 0 rlineto
72 rotate 1 0 rlineto
72 rotate 1 0 rlineto
72 rotate 1 0 rlineto
72 rotate 1 0 rlineto
stroke
grestore
gsave
0 1 0 setrgbcolor
newpath 0 0 moveto
-90 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
stroke
grestore
gsave
0 1 0 setrgbcolor
newpath 0 0 moveto
150 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
60 rotate 1 0 rlineto
stroke
grestore
0 setgray
(108) 0.4 1.45 txt
(54) -0.1 0.2 txt
(cos(a)*cos(54)) 0.37 0.63 txt
(sin(30)) -1.31 0.4 txt
(120) -0.9 -1.35 txt
(30) -0.35 0.1 txt
(a = arccos(sin(30) / cos(54))) 0 1.85 txt
(fold angle a that makes Y-coordinate of marked vertices match) 0 2 txt
(determination of C60 fullerene (truncated icosahedron)) 0 2.20 txt
(marked vertex Z-coordinate for angle a is sin(a)*cos(54) ==>) 0 -1.85 txt
(angle b between marked vertex and heatbed is arcsin(sin(a)*cos(54))=18 deg) 0 -2 txt
gsave
newpath 0 0 moveto
30 cos -1 mul 0 rmoveto
0 30 sin rlineto
stroke
grestore
gsave
newpath 0 0 moveto
0 36 sin rlineto
stroke
grestore
gsave
() 0.03 36 cos -1 mul 36 sin vertex
() 0.03 30 cos -1 mul 30 sin vertex
grestore
showpage
@Hermann-SW
Copy link
Author

Hermann-SW commented May 15, 2022

Screenshot taken after command "gv calc60.ps":

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment