Sha256: 02bf3039a077f66c093778736d4fbfe694892455deba362cfc95b7c0752db5b8

Contents?: true

Size: 494 Bytes

Versions: 12

Compression:

Stored size: 494 Bytes

Contents

require 'rays/ext'


module Rays


  class Polyline

    include Enumerable

    def initialize(*points, loop: false)
      setup points, loop
    end

    def transform(matrix = nil, loop: loop?, &block)
      points = to_a
      points = points.map {|point| matrix * point} if matrix
      points = block.call points if block
      self.class.new(*points, loop: loop)
    end

    def inspect()
      "#<Rays::Polyline #{to_a.join ', '}, loop: #{loop?}>"
    end

  end# Polyline


end# Rays

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rays-0.1.47 lib/rays/polyline.rb
rays-0.1.46 lib/rays/polyline.rb
rays-0.1.45 lib/rays/polyline.rb
rays-0.1.44 lib/rays/polyline.rb
rays-0.1.43 lib/rays/polyline.rb
rays-0.1.42 lib/rays/polyline.rb
rays-0.1.40 lib/rays/polyline.rb
rays-0.1.39 lib/rays/polyline.rb
rays-0.1.38 lib/rays/polyline.rb
rays-0.1.37 lib/rays/polyline.rb
rays-0.1.36 lib/rays/polyline.rb
rays-0.1.35 lib/rays/polyline.rb