Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/extras/Obliq.m4

raw
1 .PS
2 threeD_init
3 scale = 2.54
4
5 divert(-1)
6 `ProjectObliq(x,y,z,x scale,degrees)
7 oblique projection
8 arg4= x scale (default 1/2)'
9 define(`ProjectObliq',`(`$2'-dnl
10 (`$1')ifelse(`$4',,/2,*(`$4'))*cosd(ifelse(`$5',,obliqueangle_,(`$5'))),dnl
11 `$3'-(`$1')ifelse(`$4',,/2,*(`$4'))*sind(ifelse(`$5',,obliqueangle_,(`$5'))))')
12 define(`obliqueangle_',45)
13
14 divert(0)dnl
15
16 define(`Pr',`ProjectObliq(`$1',`$2',`$3')')
17
18 d = 2
19 define(`cube',`[ # w, h, d, scale, degrees
20 define(`cubewd',ifelse(`$1',,linewid,`$1'))dnl
21 define(`cubeht',ifelse(`$2',,cubewd,`$2'))dnl
22 define(`cubedp',ifelse(`$3',,cubewd,`$3'))dnl
23 for_(0,7,1,`P`'binary_(m4x,3): \
24 Pr(ifelse(eval(m4x/4),1,cubedp,0),
25 ifelse(eval((m4x%4)/2),1,cubewd,0),
26 ifelse(eval(m4x%2),1,cubeht,0))')
27 # {command "{\small"
28 # for_(0,7,1,`"binary_(m4x,3)" at P`'binary_(m4x,3)')
29 # command "}"
30 # }
31 {"000" at P000}
32 if obliqueangle_ > 0 then {
33 line dashed from P100 to P000 chop linethick bp__ * 2 chop 0
34 line dashed from P010 to P000 chop linethick bp__ * 2 chop 0
35 line dashed from P001 to P000 chop linethick bp__ * 2 chop 0
36 line from P101 to P001
37 line to P011
38 line to P111
39 line to P101
40 line to P100
41 line to P110
42 line to P010
43 line to P011
44 line from P110 to P111
45 } else {
46 line dashed from P101 to P001 chop linethick bp__ * 2 chop 0
47 line dashed from P011 to P001 chop linethick bp__ * 2 chop 0
48 line dashed from P000 to P001 chop linethick bp__ * 2 chop 0
49 line from P100 to P101
50 line to P111
51 line to P110
52 line to P100
53 line to P000
54 line to P010
55 line to P011
56 line to P111
57 line from P010 to P110
58 }
59 ]')
60
61 Cube: cube(1,2,3)
62 #
63 ##{arrow from Cube.P001 to 3/2 between Cube.P000 and Cube.P001; "$z$" ljust }
64 ##{arrow from Cube.P010 to 3/2 between Cube.P000 and Cube.P010; "$y$" below }
65 ##{arrow from Cube.P100 to 3/2 between Cube.P000 and Cube.P100; "$x$" ljust }
66
67 move define(`obliqueangle_',30); cube(1,2,3)
68 move define(`obliqueangle_',15); cube(1,2,3)
69 move define(`obliqueangle_',-15); cube(1,2,3)
70 move define(`obliqueangle_',-30); cube(1,2,3)
71
72 .PE