Constant-width rules
Posted: Sat Apr 21, 2007 9:27 pm
I'm new to CFDG and have just run into my first problem. I'm trying to draw an image in which all of the lines have the same thickness but different lengths. However, CFDG isn't transforming my shapes in the way that I'd expect. Consider the following code:
That draws a line from (0,0) to (1,0), as I'd expect. Next, I rotate it 90 degrees clockwise and make it half as long:
That, too, behaves as I'd expect. But if I draw a third line that should be half again as long but the same thickness...
...I get a curve that's correctly rotated and correctly translated but is equally long and half as thick as the previous line. In this case I can correct the size with but my intention is to draw this sort of pattern (and others) recursively so I don't want to have to specify unique scaling for each line.
Can someone please explain to me (a) why scaling doesn't seem to be relative to the current coordinate system and (b) how I can draw lines with fixed widths in a recursive pattern?
Thanks,
-- Scott
P.S. This is with cfdg - 1.2 experimental(v5) on Linux (from ContextFreeSource2.0.tgz).
Code: Select all
startshape CW
rule UnitLine {
SQUARE { x 0.5 size 1 0.1}
}
rule CW {
UnitLine { }
}
Code: Select all
startshape CW
rule UnitLine {
SQUARE { x 0.5 size 1 0.1}
}
rule CW {
UnitLine { }
CW2 { x 1 r -90 size 0.5 1 }
}
rule CW2 {
UnitLine { }
}
Code: Select all
startshape CW
rule UnitLine {
SQUARE { x 0.5 size 1 0.1}
}
rule CW {
UnitLine { }
CW2 { x 1 r -90 size 0.5 1 }
}
rule CW2 {
UnitLine { }
CW3 { x 1 r -90 size 0.5 1 }
}
rule CW3 {
UnitLine { }
}
Code: Select all
CW3 { x 1 r -90 size 0.25 2 }
Can someone please explain to me (a) why scaling doesn't seem to be relative to the current coordinate system and (b) how I can draw lines with fixed widths in a recursive pattern?
Thanks,
-- Scott
P.S. This is with cfdg - 1.2 experimental(v5) on Linux (from ContextFreeSource2.0.tgz).