Module: Wireframe

Defined in:
lib/experimental.rb

Instance Method Summary collapse

Instance Method Details

#build_wireframe(opts) ⇒ Object



11
12
13
14
15
16
# File 'lib/experimental.rb', line 11

def build_wireframe opts
  scale = 5
  @wireframe = opts[:points].cycle.each_cons(2).take(opts[:points].length)
  @wireframe.map!{ |p1, p2| [Vector2d.new( p1[0] * scale, p1[1] * scale ), Vector2d.new( p2[0] * scale, p2[1] * scale )] }
  @wireframe.pop unless opts[:close]
end

#drawObject



18
19
20
21
22
23
24
25
# File 'lib/experimental.rb', line 18

def draw
  super
  return
  @wireframe.each do |v1, v2|
    radians = @angle.degrees_to_radians
    $lotu.draw_line(v1.rotate(radians).x + x, v1.rotate(radians).y + y, @color, v2.rotate(radians).x + x, v2.rotate(radians).y + y, @color)
  end if @wireframe
end