$:.push "work"
$:.push "../work"

require "num/dcl"
include DCL
include Math

def cube
  n = 5
  x = [-1.0,  1.0, 1.0, -1.0, -1.0]
  y = [-1.0, -1.0, 1.0,  1.0, -1.0]
  
  for i in 0..3
    i1, i2 = i, i+1
    szopl3
    szmvl3(x[i1], y[i1],  1.0)
    szpll3(x[i2], y[i2],  1.0)
    szpll3(x[i2], y[i2], -1.0)
    szpll3(x[i1], y[i1], -1.0)
    szcll3
  end
end

iws = (ARGV[0] || (sgpwsn; gets)).to_i

sgopn(iws)
slpwwr(1)
sglset('LCLIP', true) 

dt = PI/10
20.times{|i|
  sgfrm
  th = i*dt
  xeye = 10*cos(th)
  yeye = 10*sin(th)
  zeye = 2.0
  scsobj(0.0, 0.0, 0.0)
  scseye(xeye, yeye, zeye)
  scsprj
  cube
}

sgcls
