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)
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