-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of my past work with cfdg
- Loading branch information
Alex Bruce
committed
Nov 1, 2022
1 parent
1a4bde0
commit 852a1ee
Showing
25 changed files
with
1,533 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
**.png | ||
**.jpg | ||
**.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
// Chris Coyne, copyright 2006 | ||
// Creative Commons licensed: Creative Commons Attribution 3.0 Unported | ||
CF::Background = [b 1 0.5] | ||
CF::MinimumSize = 0.1 | ||
CF::Impure = 1 | ||
CF::Size = [s 1.7 1.7] | ||
|
||
strokeWidth=0.0025 | ||
|
||
startshape isoGrid() | ||
|
||
shape isoGrid { | ||
loop yi = 50 [ y (0.5/(-50/2)) z 500] | ||
loop xi = 50 [ x (1 /( 50/2))] | ||
if (rand(0,1) <= 0.1) iso() [x -1 0.5 z randint(0,499)] | ||
} | ||
|
||
shape iso { | ||
isoTop() [] | ||
isoFill() [z -0.01 h 1 (60*randint(0,6)) sat 1 0.75 b 1 0.6 ] | ||
SQUARE [trans 0 0 -1 -0.5 0 -1 b 1 z -0.2 y -0.5] | ||
} | ||
|
||
shape isoFill | ||
rule 0.5 { | ||
isoFillDown(select(rand(4),200,100,50,25)) [] | ||
isoFillDown(select(rand(3),100,50,25)) [f 90] | ||
} | ||
rule 0.25 { | ||
isoFillDown(select(rand(4),200,100,50,25)) [] | ||
} | ||
rule 0.25 { | ||
isoFillDown(select(rand(3),100,50,25)) [f 90] | ||
} | ||
rule { | ||
isoFillLeft(select(rand(3),100,50,25)) [] | ||
} | ||
rule { | ||
isoFillLeft(select(rand(3),100,50,25)) [f 90] | ||
} | ||
rule { | ||
isoFillWide(select(rand(4),100,50,25,12.5)) [] | ||
} | ||
rule {} | ||
|
||
shape isoFillDown(n) { | ||
loop n [x (1/n) (-0.5/n)] isoDown() [] | ||
} | ||
|
||
path isoDown { | ||
LINETO(0,-1) | ||
STROKE(strokeWidth)[] | ||
} | ||
|
||
shape isoFillLeft(n) { | ||
loop n-1 [x (-1/n) (-0.5/n)] isoLeft() [x (-1/n) (-0.5/n)] | ||
} | ||
|
||
path isoLeft { | ||
LINETO(1,-0.5) | ||
STROKE(strokeWidth)[] | ||
} | ||
|
||
shape isoFillWide(n) { | ||
loop w=n-1 [] isoWide(w/(n)) [] | ||
} | ||
|
||
path isoWide(w) { | ||
MOVETO(-w,-w/2) | ||
LINETO(w,-w/2) | ||
STROKE(strokeWidth)[] | ||
} | ||
|
||
path isoTop { | ||
MOVETO(-1,-0.5) | ||
LINETO(0,0) | ||
LINETO(1,-0.5) | ||
STROKE(strokeWidth)[] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Chris Coyne, copyright 2006 | ||
// Creative Commons licensed: Creative Commons Attribution 3.0 Unported | ||
CF::Background = [b 1 0.5] | ||
CF::MinimumSize = 0.1 | ||
CF::Impure = 1 | ||
CF::Size = [s 10 10 x -12 y -12] | ||
|
||
strokeWidth=0.01 | ||
|
||
startshape boxGrid() [] | ||
|
||
shape boxGrid { | ||
n=200 | ||
loop n [ y sqrt(0.02) z -1000 b 0.05 ] | ||
loop n [ x sqrt(0.02) ] | ||
if(randint(0,5)==0) box() [r (45 + randint(0,4)*90) z -randint(0,999)] | ||
} | ||
|
||
shape box { | ||
hueColor=(randint(6)*60) | ||
SQUARE [b 1 1 z -0.2] | ||
fill() [b 1 0.6 sat 1 0.7 h 1 hueColor z -0.1] | ||
outline() [h 1 hueColor sat 1 0.7 b 1 0.6] | ||
} | ||
|
||
shape fill | ||
rule { | ||
squareFill()[] | ||
} | ||
rule { | ||
downFill()[] | ||
} | ||
rule { | ||
diagFill()[] | ||
} | ||
rule 0.2 { | ||
|
||
} | ||
|
||
shape squareFill { | ||
n=select(randint(3),10,20,40) | ||
loop xi = n [ x (1/n) ] | ||
loop yi = n [ y (1/n) ] | ||
if(mod((xi+yi),2)) SQUARE [s (1/n) x (-(n/2-0.5)/n) (-(n/2-0.5)/n) ] | ||
} | ||
|
||
path downFill { | ||
n=select(randint(3),10,20,40) | ||
loop n-1 [x (1/n)]{ | ||
MOVETO((-(n/2-1)/n),0.5 ) | ||
LINETO((-(n/2-1)/n),-0.5) | ||
} | ||
STROKE(strokeWidth, CF::SquareCap) [] | ||
} | ||
|
||
shape diagFill { | ||
n=select(randint(3),10,20,40) | ||
loop i=n [] diagFillLine(i/n)[] | ||
loop i=n [] diagFillLine(i/n)[f -45] | ||
} | ||
|
||
path diagFillLine(w) { | ||
MOVETO(-0.5 + w, 0.5 ) | ||
LINETO( 0.5 ,-0.5 + w) | ||
STROKE(strokeWidth) [] | ||
} | ||
|
||
path outline { | ||
MOVETO( 0.5, 0.5) | ||
LINETO( 0.5,-0.5) | ||
LINETO(-0.5,-0.5) | ||
LINETO(-0.5, 0.5) | ||
LINETO( 0.5, 0.5) | ||
STROKE(strokeWidth, CF::SquareCap)[] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
// Chris Coyne, copyright 2006 | ||
// Creative Commons licensed: Creative Commons Attribution 3.0 Unported | ||
CF::Background = [b 1] | ||
CF::MinimumSize = 0.5 | ||
|
||
startshape split(0) | ||
baseSpace = 0.003 | ||
spaceIncrease = 1.5 | ||
maxDepth = 8 | ||
|
||
shape split(natural depth) { | ||
spacing = baseSpace*(spaceIncrease)^depth | ||
scale = 0.5 - spacing | ||
shift = 0.25 + spacing/2 | ||
|
||
leaf(=) [x shift y -shift s scale r (randint(4)*90)] | ||
leaf(=) [x -shift y -shift s scale r (randint(4)*90)] | ||
leaf(=) [x -shift y shift s scale r (randint(4)*90)] | ||
leaf(=) [x shift y shift s scale r (randint(4)*90)] | ||
} | ||
|
||
path donut_bit(natural depth) { | ||
spacing = baseSpace*(spaceIncrease)^depth | ||
MOVETO(0+spacing, 0.5) | ||
LINETO(0.5, 0.5) | ||
ARCTO(-0.5, -0.5, 1, CF::ArcCW) | ||
LINETO(-0.5, 0-spacing) | ||
ARCTO(0+spacing, 0.5, 0.5) | ||
CLOSEPOLY() | ||
FILL[] | ||
} | ||
|
||
shape grid3(vector9 g){ | ||
loop xz = 3 [ x (1/3) ] | ||
loop yz = 3 [ y (1/3) ] | ||
if (g[xz + yz*3]) SQUARE [s (1/3) x (-1/3) y (-1/3) ] | ||
} | ||
|
||
shape grid5(vector25 g){ | ||
loop xz = 5 [ x (1/5) ] | ||
loop yz = 5 [ y (1/5) ] | ||
if (g[xz + yz*5]) SQUARE [s (1/5) x (-2/5) y (-2/5) ] | ||
} | ||
|
||
path dStripe(start, stop){ | ||
MOVETO(-0.5,-0.5+start) | ||
LINETO(-0.5, stop-0.5) | ||
LINETO( stop-0.5,-0.5) | ||
LINETO(-0.5+start,-0.5) | ||
CLOSEPOLY() | ||
FILL[] | ||
} | ||
|
||
shape hazard2 { | ||
n = 2 | ||
loop i = n [ ] dStripe(0/(n*2) + i/n, 1/(n*2) + i/n) [ ] | ||
loop i = n [ ] dStripe(1/(n*2) + i/n, 2/(n*2) + i/n) [ r 180 ] | ||
} | ||
|
||
shape hazard3 { | ||
n = 3 | ||
loop i = n [ ] dStripe(0/(n*2) + i/n, 1/(n*2) + i/n) [ ] | ||
loop i = n [ ] dStripe(1/(n*2) + i/n, 2/(n*2) + i/n) [ r 180 ] | ||
} | ||
|
||
shape hazard4 { | ||
n = 4 | ||
loop i = n [ ] dStripe(0/(n*2) + i/n, 1/(n*2) + i/n) [ ] | ||
loop i = n [ ] dStripe(1/(n*2) + i/n, 2/(n*2) + i/n) [ r 180 ] | ||
} | ||
|
||
shape leaf(natural depth) | ||
rule { | ||
figure(depth +1) [] | ||
} | ||
rule 1.7 { | ||
if (depth < maxDepth) split(depth + 1) [] | ||
if (depth >= maxDepth) figure(depth + 1) [] | ||
} | ||
|
||
shape figure(natural depth) | ||
rule { | ||
SQUARE [] | ||
} | ||
rule { | ||
SQUARE [] | ||
SQUARE [s 0.5 b 1] | ||
} | ||
rule { | ||
CIRCLE [] | ||
} | ||
rule { | ||
CIRCLE [] | ||
CIRCLE [s 0.5 b 1] | ||
} | ||
rule { | ||
grid3((1,0,1, | ||
1,1,1, | ||
0,1,0)) [] | ||
} | ||
rule { | ||
grid3((1,1,1, | ||
1,0,0, | ||
1,1,1)) [] | ||
} | ||
rule { | ||
grid3((1,0,0, | ||
0,1,0, | ||
0,0,1)) [] | ||
} | ||
rule { | ||
grid3((1,0,1, | ||
1,1,1, | ||
1,0,1)) [] | ||
} | ||
rule { | ||
grid3((1,0,0, | ||
1,1,1, | ||
0,0,1)) [] | ||
} | ||
rule { | ||
grid3((1,0,0, | ||
1,0,0, | ||
1,1,1)) [] | ||
} | ||
rule { | ||
grid5((1,1,1,1,1, | ||
1,0,0,0,1, | ||
1,1,1,1,1, | ||
1,0,0,0,1, | ||
1,0,0,0,1)) [] | ||
} | ||
rule { | ||
grid5((1,0,1,0,1, | ||
1,0,1,0,0, | ||
1,0,1,1,1, | ||
1,0,0,0,0, | ||
1,1,1,1,1)) [] | ||
} | ||
rule { | ||
hazard2 [] | ||
} | ||
rule { | ||
if(depth < maxDepth - 1) hazard3 [] | ||
} | ||
rule { | ||
if(depth < maxDepth - 2) hazard4 [] | ||
} | ||
rule { | ||
donut_bit(depth) [] | ||
} | ||
rule { | ||
|
||
} |
Oops, something went wrong.