Class: PointThinner

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-doom.rb

Instance Method Summary collapse

Constructor Details

#initialize(p, factor) ⇒ PointThinner

Returns a new instance of PointThinner.



64
65
66
67
# File 'lib/ruby-doom.rb', line 64

def initialize(p, factor)
  @points = p
  @factor = factor
end

Instance Method Details

#thinObject



68
69
70
71
72
# File 'lib/ruby-doom.rb', line 68

def thin
  newline = [@points[0]]
  1.upto(@points.size-1) {|x| newline << @points[x] if x % @factor == 0 }
  newline  
end