Diagonal and rectangle shapes

If you're having trouble using Context Free or don't understand the language, ask for help here.

Moderators: MtnViewJohn, chris, mtnviewmark

Post Reply
BigFresh

Diagonal and rectangle shapes

Post by BigFresh »

Okay, I saw this program on Attack of the Show on G4TV, and I decided to give it a try.

My questions are this: How do I draw a solid diagonal line (so it's not "pixelated")? Also, Is it possible to draw a rectangle with a single square command, or do I have to use multiple square commands?

Thank you in advance.

User avatar
LaT3x
Posts: 68
Joined: Wed Jul 06, 2005 3:11 pm
Location: Madrid, Spain

Post by LaT3x »

Hello.

At the moment, there aren't a unique SQUARE command to generate a rectangle. You must to do it. Chris is waiting for somebody to do it :) [ http://www.chriscoyne.com/cfdgforums/viewtopic.php?t=15 ]
Example of rectangle:

Code: Select all

rule rectangle2by6{
SQUARE {size 2 x -2}
SQUARE {size 2 x}
SQUARE {size 2 x 2}
}

rule rectangle6by2 {
rectangle2by6 {rotate 180}
}

rule rectangle12by4 {
rectangle2by6 {size 2}
}
About the "perfect" diagonal, you must to create a line, rectangle or any figure and next, rotate this to get it. Example:

Code: Select all


startshape diagonal

rule diagonal {
  line { r   5 }
  line { x 10 r 25 }
  line { x 20 r 45 }
}

rule line { 
  SQUARE{}  
  SQUARE { x 1} 
  SQUARE { x 2} 
  SQUARE { x 3} 
  SQUARE { x 4} 
  SQUARE { x 5} 
  SQUARE { x 6} 
  // ... recursion ... 
}
Good luck :)

(Sorry about my poor english :cry: )

User avatar
MtnViewJohn
Site Admin
Posts: 882
Joined: Fri May 06, 2005 2:26 pm
Location: Mountain View, California
Contact:

Post by MtnViewJohn »

In version 1.1 (due any day now) you can have aspect ratio control:

Code: Select all

rule rectangle2by6{ 
    SQUARE {size 2 6} 
} 

rule rectangle6by2 { 
    SQUARE {size 6 2} 
} 

rule rectangle12by4 { 
    SQUARE {size 12 4} 
} 
I have some ideas for line primitives but they won't be in v1.1.

BigFresh

Post by BigFresh »

Thanks a bunch! I got my shape worked out perfectly!

Post Reply