summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m4
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2022-11-30 20:30:02 +0000
committerKarl Berry <karl@freefriends.org>2022-11-30 20:30:02 +0000
commit8624a5d970faf95011e4ab23ae9e567bc93a8575 (patch)
treefeec6bb6fe5a35bbece9b29e82b64e2b947294c4 /Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m4
parenta63a0445b5ba9dafe9858cdc6f18f3b3711b35b1 (diff)
circuit_macros (30nov22)
git-svn-id: svn://tug.org/texlive/trunk@65149 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m4')
-rw-r--r--Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m467
1 files changed, 67 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m4 b/Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m4
new file mode 100644
index 00000000000..db03d7b3c37
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/circuit-macros/examples/dpv/CrullerDPV.m4
@@ -0,0 +1,67 @@
+.PS
+# CrullerDPV.m4
+threeD_init
+NeedDpicTools
+scale = 2.54
+
+define(`lobe',`(sind(6*(`$1'))+4)/5*2.25')
+
+ viewazimuth = 20 # Set view angles in degrees
+ viewelevation = 30
+ setview(viewazimuth,viewelevation,0)
+
+ dt = 3 # major angle degrees per facet
+ ds = 10 # minor angle degrees per facet
+
+ tradius = 6
+define(`cruller',`rot3Dz((`$1')*dtor_,
+ sum3D(0,tradius,0,0,Rect_(lobe(`$2'+2*(`$1')),`$2')))')
+
+define(`tvisible',`dot3D(View3D,
+ cross3D(diff3D(cruller(`$1'+dt/2,`$2'),cruller(`$1',`$2')),
+ diff3D(cruller(`$1',`$2'+ds/2),cruller(`$1',`$2'))))')
+
+ # create the arrays and sort
+ n = 0
+ for t = dt to 360+dt/2 by dt do {
+ for s=ds/2 to 360.1 by ds do {
+ if tvisible(t,s) > -0.01 then {
+ n +=1
+ t[n] = t
+ s[n] = s
+ d[n] = dot3D(cruller(t,s),view3D1,view3D2,view3D3) # view distance
+ ix[n] = n
+ }
+ } }
+# prval(n)
+ dpquicksort(d,1,n,ix)
+
+ # Background
+Bne: (9,6)
+Bsw: (-9,-6)
+B: 0.5 between Bne and Bsw
+iflatex(`line fill_(0.75) \
+ from (Bsw,Bne) to Bsw then to (Bne,Bsw) then to Bne then to (Bsw,Bne)',
+ `ShadedPolygon((Bsw,Bne):Bsw:(Bne,Bsw):Bne,,-30,
+ 0,1,1,1,
+ .5,.1,.4,0,
+ 1,0,0,0) at B')
+ # draw the facets
+thinlines_
+[
+ rgbtohsv(0.6,0.4,0,h,s,v)
+ for i = 1 to n do {
+ tc = t[ix[i]]; sc = s[ix[i]]
+ SE: Project(cruller(tc+dt/2,sc-ds/2))
+ SW: Project(cruller(tc-dt/2,sc-ds/2))
+ NW: Project(cruller(tc-dt/2,sc+ds/2))
+ NE: Project(cruller(tc+dt/2,sc+ds/2))
+ f = ((dcosine3D(3,cruller(tc,sc))/2.25+1)/2)^2
+ hsvtorgb(h,(1-f)*s,1,r,g,b)
+ line outlined rgbstring(r,g,b) shaded rgbstring(r,g,b) ifpdf( invis ) \
+ from SE to SW then to NW then to NE then to SE }
+ ] at B
+
+thicklines_
+
+.PE