Reptiles!

If you have a design you're proud of, share the cfdg file here. It's also a good place to ask for feedback and collaborate.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
signal
Posts: 5
Joined: Thu Jul 07, 2005 7:37 pm

Reptiles!

Post by signal »

I’m kind of proud of this one.
One question: Are the gaps created by the recursion bottoming out?

Code: Select all

startshape START

rule START{
RTILE2 {s 0.5 x 3}
RTILE2 {s 0.5 x 1.5}
RTILE2 {s 0.5 x 1 y 0.8666 r 180}
RTILE {s 0.5 x 1 y 1.7321 r -120}
}

rule LINE {
SQUARE {y 0}
SQUARE {y 1}
SQUARE {y 2}
SQUARE {y 3}
SQUARE {y 4}
SQUARE {y 5}
SQUARE {y 6}
SQUARE {y 7}
SQUARE {y 8}
SQUARE {y 9}
SQUARE {y 10}
}

rule RTILE 0.5 {
LINE {s 0.1 r -30 }
LINE {s 0.1 r -30 x 0.5 y 0.8666 }
LINE {s 0.1  x 1 y 1.7321 r -150 }
LINE {s 0.1  x 1.5 y 0.8666 r -90 }
LINE {s 0.1  x 2.5 y 0.8666 r -150 }
LINE {s 0.1  x 3 y 0.0 r 90 }
LINE {s 0.1  x 2 y 0.0 r 90 }
LINE {s 0.1  x 1 y 0.0 r 90 }
}

rule RTILE2 0.5 {
LINE {s 0.1 r 30 }
LINE {s 0.1 r 30 x -0.5 y 0.8666 }
LINE {s 0.1  x  -1 y 1.7321 r 150}
LINE {s 0.1  x  -1.5 y 0.8666 r 90 }
LINE {s 0.1  x -2.5 y 0.8666 r 150 }
LINE {s 0.1  x -3 y 0.0 r -90 }
LINE {s 0.1  x -2 y 0.0 r -90 }
LINE {s 0.1  x -1 y 0.0 r -90 }
}

rule RTILE {
RTILE2 {s 0.5 x 3}
RTILE2 {s 0.5 x 1.5}
RTILE2 {s 0.5 x 1 y 0.8666 r 180}
RTILE {s 0.5 x 1 y 1.7321 r -120}
}

rule RTILE2 {
RTILE {s 0.5 x -3 }
RTILE {s 0.5 x -1.5 }
RTILE {s 0.5 x -1 y 0.8666 r 180}
RTILE2 {s 0.5 x -1 y 1.7321 r 60}
}

signal
Posts: 5
Joined: Thu Jul 07, 2005 7:37 pm

Post by signal »

Oops, this works better:

Code: Select all

startshape START

rule START{
RTILE2 {s 0.5 x 3}
RTILE2 {s 0.5 x 1.5}
RTILE2 {s 0.5 x 1 y 0.8666 r 180}
RTILE {s 0.5 x 1 y 1.7321 r -120}
}

rule LINE {
SQUARE {y 0}
SQUARE {y 1}
SQUARE {y 2}
SQUARE {y 3}
SQUARE {y 4}
SQUARE {y 5}
SQUARE {y 6}
SQUARE {y 7}
SQUARE {y 8}
SQUARE {y 9}
SQUARE {y 10}
}

rule RTILE 0.5 {
LINE {s 0.1 r -30 }
LINE {s 0.1 r -30 x 0.5 y 0.8666 }
LINE {s 0.1  x 1 y 1.7321 r -150 }
LINE {s 0.1  x 1.5 y 0.8666 r -90 }
LINE {s 0.1  x 2.5 y 0.8666 r -150 }
LINE {s 0.1  x 3 y 0.0 r 90 }
LINE {s 0.1  x 2 y 0.0 r 90 }
LINE {s 0.1  x 1 y 0.0 r 90 }
}

rule RTILE2 0.5 {
LINE {s 0.1 r 30 }
LINE {s 0.1 r 30 x -0.5 y 0.8666 }
LINE {s 0.1  x  -1 y 1.7321 r 150}
LINE {s 0.1  x  -1.5 y 0.8666 r 90 }
LINE {s 0.1  x -2.5 y 0.8666 r 150 }
LINE {s 0.1  x -3 y 0.0 r -90 }
LINE {s 0.1  x -2 y 0.0 r -90 }
LINE {s 0.1  x -1 y 0.0 r -90 }
}

rule RTILE {
RTILE2 {s 0.5 x  3}
RTILE2 {s 0.5 x 1.5}
RTILE2 {s 0.5 x 1 y 0.8666 r 180}
RTILE {s 0.5 x 1 y 1.7321 r -120}
}

rule RTILE2 {
RTILE {s 0.5 x  -3 }
RTILE {s 0.5 x  -1.5 }
RTILE {s 0.5 x  -1 y 0.8666 r 180}
RTILE2 {s 0.5 x -1 y 1.7321 r 120}
}

User avatar
lagroue
Posts: 114
Joined: Wed Jul 06, 2005 11:33 pm
Location: Paris, France
Contact:

Post by lagroue »

I suppose there are gaps where lines would be too thin.

User avatar
aaronstj
Posts: 66
Joined: Wed Jul 06, 2005 11:34 am
Location: Seattle

Post by aaronstj »

First off, excellent work

Second, Lagroue is correct. After the unit becomes smaller than 0.3 pixels, CFDG will stop expanding a rule.

This version will draw lines at every step, even if it decides to decompose the tile:

Code: Select all

startshape START

rule START{
RTILE2 {s 0.5 x 3}
RTILE2 {s 0.5 x 1.5}
RTILE2 {s 0.5 x 1 y 0.8666 r 180}
RTILE {s 0.5 x 1 y 1.7321 r -120}
}

rule LINE {
SQUARE {y 0}
SQUARE {y 1}
SQUARE {y 2}
SQUARE {y 3}
SQUARE {y 4}
SQUARE {y 5}
SQUARE {y 6}
SQUARE {y 7}
SQUARE {y 8}
SQUARE {y 9}
SQUARE {y 10}
}


rule RTILE 0.5 {
	RTILELines {}
}

rule RTILELines 0.5 {
LINE {s 0.1 r -30 }
LINE {s 0.1 r -30 x 0.5 y 0.8666 }
LINE {s 0.1  x 1 y 1.7321 r -150 }
LINE {s 0.1  x 1.5 y 0.8666 r -90 }
LINE {s 0.1  x 2.5 y 0.8666 r -150 }
LINE {s 0.1  x 3 y 0.0 r 90 }
LINE {s 0.1  x 2 y 0.0 r 90 }
LINE {s 0.1  x 1 y 0.0 r 90 }
}

rule RTILE2 0.5 {
	RTILE2Lines {}
}

rule RTILE2Lines {
LINE {s 0.1 r 30 }
LINE {s 0.1 r 30 x -0.5 y 0.8666 }
LINE {s 0.1  x  -1 y 1.7321 r 150}
LINE {s 0.1  x  -1.5 y 0.8666 r 90 }
LINE {s 0.1  x -2.5 y 0.8666 r 150 }
LINE {s 0.1  x -3 y 0.0 r -90 }
LINE {s 0.1  x -2 y 0.0 r -90 }
LINE {s 0.1  x -1 y 0.0 r -90 }
}

rule RTILE {
RTILELines{}
RTILE2 {s 0.5 x  3}
RTILE2 {s 0.5 x 1.5}
RTILE2 {s 0.5 x 1 y 0.8666 r 180}
RTILE {s 0.5 x 1 y 1.7321 r -120}
}

rule RTILE2 {
RTILE2Lines{}
RTILE {s 0.5 x  -3 }
RTILE {s 0.5 x  -1.5 }
RTILE {s 0.5 x  -1 y 0.8666 r 180}
RTILE2 {s 0.5 x -1 y 1.7321 r 120}
}

signal
Posts: 5
Joined: Thu Jul 07, 2005 7:37 pm

Post by signal »

aaronstj: brilliant, that’s what was needed to get rid of the gaps.
Full disclosure: I didn’t see Jay’s reptile script http://chriscoyne.com/cfdgforums/viewto ... ht=reptile
until after my first post, but a quick scan through his code showed me where the error was in my original version.
Thanks!

Post Reply