Sha256: a6f1be095c873a416efe000c9cf78fc602de2975bf51c34017978d624845697b

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

# I Like Icosahedra
# by Ira Greenberg.
# 
# This example plots icosahedra. The Icosahdron is a regular
# polyhedron composed of twenty equalateral triangles.

# fjenett, 2010-03-11:
# This is by far not an exact translation of Iras code. I removed
# the unneeded Dimension3D class, simplyfied Shape3D and improved
# the Icosahedron class. That and the rubyfication ...
require './icosahedron' # load icosahedron.rb



def setup
    
    size 640, 360, P3D
    
    @ico1 = Icosahedron.new 75
    @ico2 = Icosahedron.new 75
    @ico3 = Icosahedron.new 75
    
end

def draw
    
  	background 0
  	lights
  	
  	translate width/2, height/2
  	
  	push_matrix
  	
  	translate -width/3.5, 0
  	rotate_x frame_count * PI / 185
  	rotate_y frame_count * PI / -200
  	
  	stroke 170, 0, 0
  	no_fill
  	
  	@ico1.draw
  	
  	pop_matrix
  	
  	push_matrix
  	
  	rotate_x frame_count * PI / 200
  	rotate_y frame_count * PI / 300
  	
  	stroke 170, 0, 180
  	fill 170, 170, 0
  	
  	@ico2.draw
  	
  	pop_matrix
  	
  	push_matrix
  	
  	translate width/3.5, 0
  	rotate_x frame_count * PI / -200
  	rotate_y frame_count * PI / 200
  	
  	no_stroke
  	fill 0, 0, 185
  	
  	@ico3.draw
  	
  	pop_matrix
  	
end


Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-processing-2.4.3 samples/processing_app/basics/form/icosahedra/icosahedra.rb
ruby-processing-2.4.2 samples/processing_app/basics/form/icosahedra/icosahedra.rb
ruby-processing-2.4.1 samples/processing_app/basics/form/icosahedra/icosahedra.rb