summaryrefslogtreecommitdiff
path: root/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/circuit_macros/examples/svg/SierpinskiSVG.m4')
-rw-r--r--graphics/circuit_macros/examples/svg/SierpinskiSVG.m430
1 files changed, 29 insertions, 1 deletions
diff --git a/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4 b/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4
index 3a014b8a0f..7fbf13bf15 100644
--- a/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4
+++ b/graphics/circuit_macros/examples/svg/SierpinskiSVG.m4
@@ -1,6 +1,7 @@
.PS
# Sierpinski.m4
gen_init
+[
define Sierpinski {
if $1 > 0.04 then {
d = $1/2-lh
@@ -14,6 +15,7 @@ gen_init
r = 4
linethick = 0.2
+ #linethick = 1/2 /(1pt__)
lw = linethick pt__ /2
s3 = sqrt(3)
lh = lw*s3
@@ -21,6 +23,32 @@ gen_init
d = r/2-lh
shade(0,line from A+(0,lw) right d then up d*s3 left d then down d*s3 left d\
then right d )
-# psset_(linecolor=white)
+ ifpstricks(`psset_(linecolor=white)')
Sierpinski(r/2,A)
+
+ ifpstricks(`psset_(linecolor=black)')
+ thicklines_
+ ]
+
+# CayleyGraph.m4
+[
+define CayleyGraph {
+ if $3 > 0 then {
+ { line to Here+(cosd($2),sind($2))*($1)
+ exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2,$3-1); }
+ { line to Here+(cosd($2+90),sind($2+90))*($1)
+ exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2+90,$3-1); }
+ { line to Here+(cosd($2-90),sind($2-90))*($1)
+ exec sprintf("CayleyGraph(%g,%g,%g);",0.5*($1),$2-90,$3-1); }
+ }
+ }
+
+ size = 2
+ depth = 6
+ for t=0 to 270 by 90 do {
+ line from (0,0) to (cosd(t),sind(t));
+ { exec sprintf("CayleyGraph(%g,%g,%g);",size/4,t,depth); }
+ }
+ ] with .sw at last [].se+(-0.25,0)
+
.PE