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

Tuesday 18 February 2014

More explorations of shape primitives in ruby-processing (JRubyArt)

I have now created a experimental "shape" library class for ruby-processing see the development branch at JRubyArt. This very much work in progress, but the box class is somewhat influenced by toxiclibs "axis bounding box" AABB class. But for the idiosyncratic axis convention lo would correspond to back lower left, and hi to front upper right.
load_libraries :vecmath, :shape

attr_reader :my_shape

def setup
  size 200, 200, P3D
  camera(100.0, 100.0, 120.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0)
  my_box = Box.new
  my_box.scale(size: 100)
  #my_box.scale(x: 50, y: 30, z: 80)
  fill 100, 100, 100, 100
  @my_shape = create_shape(BOX, *my_box.dimension)
  my_shape.translate(*my_box.center)
end

def draw
  lights
  fill 200, 0, 0
  no_stroke
  sphere(50)
  shape(my_shape)
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