-
Notifications
You must be signed in to change notification settings - Fork 0
/
quick.pic
119 lines (95 loc) · 5.98 KB
/
quick.pic
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.PS # Pic input begins with .PS
# cct_init Version 8.8.1: PSTricks m4 macro settings.
# gen_init Version 8.8.1: PSTricks m4 macro settings.
define rpoint__ {
rp_wid = last line.end.x-last line.start.x
rp_ht = last line.end.y-last line.start.y
rp_len = sqrt(abs((rp_wid)^2+(rp_ht)^2)); move to last line.start
rp_ang = atan2(rp_ht,rp_wid) }
rtod_ = 57.295779513082323; dtor_ = 0.017453292519943295
twopi_ = 6.2831853071795862; pi_ = (twopi_/2)
rp_ang = 0; right
linethick = 0.8
arrowwid = 0.05*scale; arrowht = 0.1*scale
command "\psset{linewidth=0.8pt}%";
command "\psset{noCurrentPoint}%"
# gen_init end
command sprintf("\psset{arrowsize=1.1pt 4,arrowlength=1.64,arrowinset=0}%%")
# cct_init end
# Read in macro definitions and set defaults
elen = 0.75 # Variables are allowed; default units are inches
Origin: Here # Position names are capitalized
line invis up elen
rpoint__
{ line to Here+((rp_len/2-(0.25*linewid))*(cos(rp_ang)),(rp_len/2-(0.25*linewid))*(sin(rp_ang)))
move to Here+(((0.25*linewid))*(cos(rp_ang)),((0.25*linewid))*(sin(rp_ang)))
{ Src_C: circle rad (0.25*linewid) at Here }
line from Here+(((0.25*linewid))*(cos(rp_ang)),((0.25*linewid))*(sin(rp_ang))) \
to Here+((rp_len/2)*(cos(rp_ang)),(rp_len/2)*(sin(rp_ang)))}
{ [box invis wid (0.25*linewid)*2 ht (0.25*linewid)*2] at Here+((rp_len/2)*(cos(rp_ang)),(rp_len/2)*(sin(rp_ang))) }
line to Here+((rp_len)*(cos(rp_ang)),(rp_len)*(sin(rp_ang))) invis ; {"$ -$" \
at last [].s rjust below }; {"$ v_s$" \
at last [].w rjust }; {"$ +$" \
at last [].n rjust above };
line invis right elen
rpoint__
if linewid/6/4*6*2 > rp_len then { line invis to Here+((linewid/6/4*6*2)*(cos(rp_ang)),(linewid/6/4*6*2)*(sin(rp_ang)))
rpoint__
}
M4_xyO: last line.c
{ line from last line.start to M4_xyO+(((linewid/6/4)*(-6))*(cos(rp_ang)),((linewid/6/4)*(-6))*(sin(rp_ang)))\
then to M4_xyO+((((linewid/6/4)*(-5))*(cos(rp_ang))+((linewid/6/4)*((2)))*((-sin(rp_ang)))),(((linewid/6/4)*(-5))*(sin(rp_ang))+((linewid/6/4)*((2)))*(cos(rp_ang)))) \
then to M4_xyO+((((linewid/6/4)*(-3))*(cos(rp_ang))+((linewid/6/4)*((-2)))*((-sin(rp_ang)))),(((linewid/6/4)*(-3))*(sin(rp_ang))+((linewid/6/4)*((-2)))*(cos(rp_ang)))) \
then to M4_xyO+(((-(linewid/6/4))*(cos(rp_ang))+((linewid/6/4)*((2)))*((-sin(rp_ang)))),((-(linewid/6/4))*(sin(rp_ang))+((linewid/6/4)*((2)))*(cos(rp_ang)))) \
then to M4_xyO+(((linewid/6/4)*(cos(rp_ang))+((linewid/6/4)*((-2)))*((-sin(rp_ang)))),((linewid/6/4)*(sin(rp_ang))+((linewid/6/4)*((-2)))*(cos(rp_ang)))) \
then to M4_xyO+((((linewid/6/4)*(3))*(cos(rp_ang))+((linewid/6/4)*((2)))*((-sin(rp_ang)))),(((linewid/6/4)*(3))*(sin(rp_ang))+((linewid/6/4)*((2)))*(cos(rp_ang)))) \
then to M4_xyO+((((linewid/6/4)*(5))*(cos(rp_ang))+((linewid/6/4)*((-2)))*((-sin(rp_ang)))),(((linewid/6/4)*(5))*(sin(rp_ang))+((linewid/6/4)*((-2)))*(cos(rp_ang)))) \
then to M4_xyO+(((linewid/6/4)*(6))*(cos(rp_ang)),((linewid/6/4)*(6))*(sin(rp_ang))) \
then to last line.end
[box invis ht linewid/6/4*2*2 wid linewid/6/4*6*2] at 2nd last line.c
}
line invis from 2nd last line.start to 2nd last line.end ; {"$ R$" \
at last [].s below };
[ circle rad (0.04*linewid) fill 0
] with .c at Here
move to last [].c
{ # Save the current position and direction
line invis down to (Here,Origin)
rpoint__
{ line to Here+((rp_len/2-linewid/3*0.3/2)*(cos(rp_ang)),(rp_len/2-linewid/3*0.3/2)*(sin(rp_ang)))
{line from Here+((-linewid/3/2)*((-sin(rp_ang))),(-linewid/3/2)*(cos(rp_ang))) \
to Here+((linewid/3/2)*((-sin(rp_ang))),(linewid/3/2)*(cos(rp_ang)))}
move to Here+((linewid/3*0.3)*(cos(rp_ang)),(linewid/3*0.3)*(sin(rp_ang)))
{line from Here+((-linewid/3/2)*((-sin(rp_ang))),(-linewid/3/2)*(cos(rp_ang))) \
to Here+((linewid/3/2)*((-sin(rp_ang))),(linewid/3/2)*(cos(rp_ang)))}
line to Here+((rp_len/2-linewid/3*0.3/2)*(cos(rp_ang)),(rp_len/2-linewid/3*0.3/2)*(sin(rp_ang)))
}
{[box invis wid linewid/3 ht linewid/3*0.3 ] at Here+((rp_len/2)*(cos(rp_ang)),(rp_len/2)*(sin(rp_ang)))}
line to Here+((rp_len)*(cos(rp_ang)),(rp_len)*(sin(rp_ang))) invis #(Here,Origin) = (Here.x,Origin.y)
{"$ +$" \
at last [].n rjust above }; {"$ v$" \
at last [].l rjust }; {"$ -$" \
at last [].s rjust below }; ; {"$ C$" \
at last [].e ljust };
[ circle rad (0.04*linewid) fill 0
] with .c at Here
move to last [].c
} # Restore position and direction
line right elen*2/3
line invis down Here.y-Origin.y
rpoint__
{ line to Here+(((rp_len-4*linewid/16*2)/2)*(cos(rp_ang)),((rp_len-4*linewid/16*2)/2)*(sin(rp_ang)))
{line to Here+((-(linethick *(scale/72)/2))*((-sin(rp_ang))),(-(linethick *(scale/72)/2))*(cos(rp_ang)))};
for m4i=1 to 4 do {
arc cw from Here to Here+((linewid/16*2)*(cos(rp_ang)),(linewid/16*2)*(sin(rp_ang))) with .c at Here+((linewid/16)*(cos(rp_ang)),(linewid/16)*(sin(rp_ang)))
{line to Here+((-(linethick *(scale/72)/2))*((-sin(rp_ang))),(-(linethick *(scale/72)/2))*(cos(rp_ang)))} }
line to Here+(((rp_len-4*linewid/16*2)/2)*(cos(rp_ang)),((rp_len-4*linewid/16*2)/2)*(sin(rp_ang)))}
{[box invis wid linewid/16+0+0 ht 4*linewid/16*2] \
at Here+(((rp_len/2)*(cos(rp_ang))+((linewid/16+0-0)/2)*((-sin(rp_ang)))),((rp_len/2)*(sin(rp_ang))+((linewid/16+0-0)/2)*(cos(rp_ang))))}
line to Here+((rp_len)*(cos(rp_ang)),(rp_len)*(sin(rp_ang))) invis ; {"$ L$" \
at last [].l rjust }; ;
{ move to last line.start+((((rp_len-last [].ht)/2*2/3+arrowht/3))*(cos(rp_ang)),(((rp_len-last [].ht)/2*2/3+arrowht/3))*(sin(rp_ang)))
arrow <- to Here+((-arrowht)*(cos(rp_ang)),(-arrowht)*(sin(rp_ang))) "$ i$" \
ljust}
line to Origin
.PE # Pic input ends