summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/svg/expSVG.m4
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/circuit_macros/examples/svg/expSVG.m4')
-rw-r--r--graphics/circuit_macros/examples/svg/expSVG.m447
1 files changed, 1 insertions, 46 deletions
diff --git a/graphics/circuit_macros/examples/svg/expSVG.m4 b/graphics/circuit_macros/examples/svg/expSVG.m4
index 27209b094e..4d12688f97 100644
--- a/graphics/circuit_macros/examples/svg/expSVG.m4
+++ b/graphics/circuit_macros/examples/svg/expSVG.m4
@@ -8,51 +8,6 @@ NeedDpicTools
# postprocessors do not have the same functionality so the following
# demonstrates how it can be done in the pic language with m4 macros.
-# `shadedpolygon(shadedpvertseq,line attributes,
-# sweep angle (degrees),colorseq)
-# arg1 is a colon (:) separated sequence of
-# positions or position names, the vertices in
-# order (cw or ccw) of the polygon. Colored
-# shade lines are drawn perpendicular to the
-# sweep angle. A colorseq is of the form
-# 0,r0,g0,b0,
-# frac1,r1,g1,b1,
-# frac2,r2,g2,b2,
-# ...
-# 1,rn,gn,bn'
-#`e.g. shadedpolygon((0,0):(0,1):(2,1):(2,0),,0,0,1,1,1,1,0,0,0)'
-define(`shadedpolygon',`[ Origin: Here
- shadedpverts(V,1,patsubst(patsubst(`$1',`,',|),:,`,'))
- nverts = m4vx
- T: (Rect_(1,`$3'))
- p0 = 1; d[1] = T.x*V[1].x + T.y*V[1].y
- pm = 1
- for i=2 to nverts do { d[i] = T.x*V[i].x + T.y*V[i].y
- if d[i] < d[p0] then { p0 = i }
- if d[i] > d[pm] then { pm = i } }
- d0 = d[p0]; dmx = d[pm]-d0
- for i=1 to nverts do { d[i] = (d[i]-d0)/dmx }
- qL = p0; pL = qL + 1; if pL > nverts then { pL = 1 }
- qR = p0; pR = qR - 1; if pR < 1 then { pR = nverts }
- nlines = int(1.5*dmx/lthick)
- ShadeObject(ShadedPline,nlines,shift(shift(shift($@)))) \
- with .Origin at Origin
- Midpt: 0.5 between V[1] and V[nverts]
- line `$2' \
- from Midpt to for_(1,m4vx,1,`V[m4x] then to\') Midpt
- Start: V[p0]; End: V[pm]
- ]')
-define(`shadedpverts',`
-ifelse($3,,,`$1[$2]: patsubst(`$3',|,`,') define(`m4vx',$2)
-shadedpverts(`$1',incr(`$2'),shift(shift(shift($@))))')')
-define ShadedPline {
- if $1 > d[pL] then { qL = pL; pL = qL + 1; if pL > nverts then {pL = 1} }
- if $1 > d[pR] then { qR = pR; pR = qR - 1; if pR < 1 then {pR = nverts} }
- M4L: ($1-d[qL])/(d[pL]-d[qL]) between V[qL] and V[pL]
- M4R: ($1-d[qR])/(d[pR]-d[qR]) between V[qR] and V[pR]
- line outlined rgbstring($2,$3,$4) \
- from M4L to M4R }
-
# Projected box object:
[
g = 1.2
@@ -183,7 +138,7 @@ thicklines_
SE: Project( rectht/2, rectwid*0.75,0)
NE: Project(-rectht/2, rectwid*0.75,0)
- shadedpolygon(NW:NE:SE:SW,,-90,
+ ShadedPolygon(NW:NE:SE:SW,,-90,
0,0.25,0.25,0.25,
1,1,1,1) with .Start at NW