Recently I've been looking at Povray, pyprocessing, and cfdg (version 3.0) as tools for creating digital images. I have branched two separate blogs where I mainly explore jruby + processing and processing.py

Saturday, 14 May 2011

Alhambra Tiling (for CFDG Version 3.0) as Context Free Rules

The new Version of Context Free Art program is at version 3.0 alpha. The new syntax supports tuples in path/shape definition. Anything defined in the shape definition is new syntax, old path is still supported inside path (except when path is nested?). Definitions are now allowed, as is a new loop syntax, parameters are supported but I haven't got that far yet with my experiments. Update 26 June 2011 now includes changed syntax (since V12 linux), and is more precisely tesselated.

startshape alhambra

SQRT3 = sqrt(3)
TTOP = sin(30)/SQRT3
HEXS = SQRT3/4
GOLD = 31      
BLUE = 201     
        
CF::Size = [s 6 x -2.5 y -3.5]  // trim to hide the ragged edge

shape alhambra{
   loop 10 [x 1]{
   loop 10 [y (SQRT3/2) x -0.5]{
   triangle[b 0.73 h BLUE sat 0.8]
   hexagon[s 0.5 b 1 r 15]      // tilt hexagon slightly
   hexastar[s 0.4 h GOLD sat 0.8 b 0.9 x -0.5 y 0.3]
   }
   }
}

path triangle {              // CF 3.0 Syntax in path loop and definition
    MOVETO(-0.5, -TTOP)
    loop 3 [r 120]{
    CURVETO(0, -TTOP, -0.25, -0.1) 
    CURVETO(0.5, -TTOP, CF::Continuous)
    }
    CLOSEPOLY() 
    FILL[]     
}

path hexagon{ 
  MOVETO(0.25, HEXS)          // 3.0 Syntax in path loop and definition
  loop 5 [r -60]{
  LINETO(0.5, 0)
  }
  CLOSEPOLY()  
  FILL[]    
} 

shape hexastar{
  TRIANGLE[r 90]
  TRIANGLE[r 270]
}

No comments:

Post a Comment

Followers

Blog Archive

About Me

My photo
Pembrokeshire, United Kingdom
I have developed JRubyArt and propane new versions of ruby-processing for JRuby-9.1.5.0 and processing-3.2.2