Experiments with ruby-processing (processing-2.2.1) and JRubyArt for processing-3.0

Friday, 12 February 2010

Developing the shapes

From the pentive? fractal it is clearly possible to develop some interesting "textured" shapes, here I produce an approximate circle from a set of rotations.


########################################################
# A Pentive fractal implemented using a
# Lindenmayer System in ruby-processing by Martin Prout
########################################################
require 'pentive'

class Pentive_Test < Processing::App
  attr_reader :pentive,:points, :production

  def setup
    size(500, 500)
    @pentive = Pentive.new(0, 0)
    @production = pentive.create_grammar(6)
    @points = pentive.translate_rules(production)
    no_loop()
  end
 
  def draw_element()
    stroke(255)
    points.each do |tmp|
      line(*tmp)
    end
  end

  def draw()
    background(0)
    translate(width/2, height/2)
    10.times do
      rotate(Math::PI/180 * 36)    
      draw_element()
    end
    save_frame("/home/tux/advance.png")
  end
end




No comments:

Post a Comment

Followers

About Me

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