1 \section{Adding dimensions to the scenery
}
3 It is very interesting to add
\Index{dimensions
} to the scenery. We take the example
4 of the methane molecule, where we want to insert the distances and angles.
6 The first step consists of representing the molecule with its bonds and
7 characteristic dimensions, and then draw it in a good looking way.
10 \begin{pspicture
}(-
4,-
4)(
4,
5)
11 \psset{viewpoint=
100 50 20 rtp2xyz,Decran=
30,RotY=-
30}
12 {\psset{lightintensity=
1,linewidth=
0.5\pslinewidth}
16 0 0.25 10.93 [8 6] newcylindre
17 {-
90 0 0 rotateOpoint3d
} solidtransform
18 dup (White) outputcolors
20 /L2
{ L1
{0 0 -
109.5 rotateOpoint3d
} solidtransform
} def
21 /L3
{ L2
{0 -
120 0 rotateOpoint3d
} solidtransform
} def
22 /L4
{ L2
{0 120 0 rotateOpoint3d
} solidtransform
} def
23 /L12
{ L1 L2 solidfuz
} def
24 /L123
{ L12 L3 solidfuz
} def
25 /Liaisons
{ L123 L4 solidfuz
} def
26 Liaisons drawsolid**
}}
27 \psPoint(
0,
10.93,
0)
{H1
}
28 \psPoint(
10.3,-
3.64,
0)
{H2
}
29 \psPoint(-
5.15,-
3.64,
8.924)
{H3
}
30 \psPoint(-
5.15,-
3.64,-
8.924)
{H4
}
31 \uput[0](H1)
{$
\mathrm{H_1
}$
}
32 \uput[l
](H2)
{$
\mathrm{H_2
}$
}
33 \uput[u
](H3)
{$
\mathrm{H_3
}$
}
34 \uput[d
](H4)
{$
\mathrm{H_4
}$
}
35 \pcline[offset=
0.25]{|-|
}(H2)(H3)
36 \pcline[offset=
0.25]{<->
}(H2)(H3)
38 \pcline[offset=
0.15]{|-|
}(H2)(O)
39 \pcline[offset=
0.15]{<->
}(H2)(O)
41 \axesIIID(
3,
3,
3)(
14,
16,
14)
42 \pspolygon[linestyle=dashed,linecolor=red
](H1)(H2)(H3)
43 \psline[linestyle=dashed,linecolor=red
](H4)(H1)
44 \psline[linestyle=dashed,linecolor=red
](H4)(H2)
45 \psline[linestyle=dashed,linecolor=red
](H4)(H3)
46 \psline[linestyle=dotted,linecolor=red
](H4)(O)
47 \psline[linestyle=dotted,linecolor=red
](H3)(O)
48 \psline[linestyle=dotted,linecolor=red
](H2)(O)
49 \psline[linestyle=dotted,linecolor=red
](H1)(O)
50 \pstMarkAngle[arrows=<->
]{H1
}{O
}{H3
}{\small 109,
5$^
{\mathrm{o
}}$
}
53 \begin{pspicture
}(-
4,-
4)(
4,
5)
54 \psset{lightsrc=
50 50 10,lightintensity=
1,viewpoint=
100 50 20 rtp2xyz,Decran=
30,RotY=-
30}
56 \psset{linewidth=
0.5\pslinewidth}
59 /H1
{2 [18 16] newsphere
60 {-
90 0 0 rotateOpoint3d
} solidtransform
61 {0 10.93 0 translatepoint3d
} solidtransform
62 dup (White) outputcolors
} def
64 0 0.25 10 [12 10] newcylindre
65 {-
90 0 0 rotateOpoint3d
} solidtransform
66 dup (White) outputcolors
68 /HL1
{ H1 L1 solidfuz
} def
69 /HL2
{ HL1
{0 0 -
109.5 rotateOpoint3d
} solidtransform
} def
70 /HL3
{ HL2
{0 -
120 0 rotateOpoint3d
} solidtransform
} def
71 /HL4
{ HL2
{0 120 0 rotateOpoint3d
} solidtransform
} def
72 /C
{3 [18 16] newsphere
73 {90 0 0 rotateOpoint3d
} solidtransform
74 dup (gris) outputcolors
} def
75 /HL12
{ HL1 HL2 solidfuz
} def
76 /HL123
{ HL12 HL3 solidfuz
} def
77 /HL1234
{ HL123 HL4 solidfuz
} def
78 /methane
{ HL1234 C solidfuz
} def
80 \psPoint(
0,
10.93,
0)
{H1
}
81 \psPoint(
10.3,-
3.64,
0)
{H2
}
82 \psPoint(-
5.15,-
3.64,
8.924)
{H3
}
83 \psPoint(-
5.15,-
3.64,-
8.924)
{H4
}}%
84 \axesIIID(
3,
3,
3)(
14,
16,
14)
85 \pspolygon[linestyle=dashed,linecolor=red
](H1)(H2)(H3)
86 \psline[linestyle=dashed,linecolor=red
](H4)(H1)
87 \psline[linestyle=dashed,linecolor=red
](H4)(H2)
88 \psline[linestyle=dashed,linecolor=red
](H4)(H3)
89 \psline[linestyle=dotted,linecolor=red
](H4)(O)
90 \psline[linestyle=dotted,linecolor=red
](H3)(O)
91 \psline[linestyle=dotted,linecolor=red
](H2)(O)
92 \psline[linestyle=dotted,linecolor=red
](H1)(O)
96 The construction of the molecule is detailed in the
document
97 \texttt{molecules.tex
}. To add a dimensioning you only need to find
98 the vertices of the tetrahedron:
100 \psPoint(
0,
10.93,
0)
{H1
}
101 \psPoint(
10.3,-
3.64,
0)
{H2
}
102 \psPoint(-
5.15,-
3.64,
8.924)
{H3
}
103 \psPoint(-
5.15,-
3.64,-
8.924)
{H4
}
105 and then use the power of the package
\texttt{pst-node
}. For the distances:
107 \pcline[offset=
0.25]{<->
}(H2)(H3)
109 \pcline[offset=
0.15]{<->
}(H2)(O)
111 \psPoint(-
5.15,-
3.64,-
8.924)
{H4
}
113 Then, for the angles, we take help from the package
\texttt{pst-eucl
}
115 \pstMarkAngle[arrows=<->
]{H1
}{O
}{H3
}{\small 109,
5$^
{\mathrm{o
}}$
}