3 # Source file position: <groff-source>/contrib/chem/chem.pic
4 # Installed position: <prefix>/share/groff/<version>/pic
6 # Copyright (C) 2006, 2008, 2009 Free Software Foundation, Inc.
7 # Written by Brian Kernighan <http://cm.bell-labs.com/cm/cs/who/bwk>,
8 # modified by Bernd Warken.
10 # This file is part of `chem', which is part of `groff'.
12 # `groff' is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by
14 # the Free Software Foundation, either version 3 of the License, or
15 # (at your option) any later version.
17 # `groff' is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ########################################################################
29 # cr = 0.08 # radius of invis circle at ring vertices (see cr[vh])
30 # crh = 0.16; crw = 0.12 # ht & wid of invis ellipse around atoms at ring vertices
31 # dav = 0.015 # vertical shift up for atoms in atom macro
33 # atom(text, wid, ht, carbon position, crh, crw, dav)
35 T: $1 wid $2 ht $3-2*$7
36 C: ellipse invis ht $5 wid $6 at T.w + ($4,$7)
37 L: ellipse invis ht $5 wid $6 at T.w + (cwid/2,$7)
38 R: ellipse invis ht $5 wid $6 at T.e + (-cwid/2,$7)
41 # bond(length, angle in degrees, whatever)
43 line $3 by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
46 # fancy bonds: r, theta, from/at
48 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
49 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
50 norm = sqrt(dx*dx + dy*dy)
53 line from V1 + (nx,ny) to V2 + (nx,ny)
54 line from V1 - (nx,ny) to V2 - (nx,ny)
58 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
59 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
60 norm = sqrt(dx*dx + dy*dy)
62 nx = -dy * .025 / norm
63 line from V1 + (nx,ny) to V2 + (nx,ny)
64 line from V1 - (nx,ny) to V2 - (nx,ny)
69 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
70 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
71 norm = sqrt(dx*dx + dy*dy)
77 line from XZ + (nx,ny) to XZ - (nx,ny)
82 line $3 invis by ($1) * sin(($2)/deg), ($1) * cos(($2)/deg)
83 V1: last line.start; V2: last line.end; dx = V2.x-V1.x; dy = V2.y-V1.y
84 ah = arrowht; aw = arrowwid; ahead = arrowhead
85 arrowht = sqrt(dx*dx + dy*dy)
89 arrowht = ah; arrowwid = aw; arrowhead = ahead