Sha256: 2e2feb16d84997108c32f4232bc63af81be6e0e1c344abadfa6644b748a4f07b

Contents?: true

Size: 522 Bytes

Versions: 9

Compression:

Stored size: 522 Bytes

Contents

# -*- coding: utf-8 -*-


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

9 entries across 9 versions & 1 rubygems

Version Path
rays-0.1.21 lib/rays/polyline.rb
rays-0.1.20 lib/rays/polyline.rb
rays-0.1.19 lib/rays/polyline.rb
rays-0.1.18 lib/rays/polyline.rb
rays-0.1.17 lib/rays/polyline.rb
rays-0.1.16 lib/rays/polyline.rb
rays-0.1.15 lib/rays/polyline.rb
rays-0.1.14 lib/rays/polyline.rb
rays-0.1.13 lib/rays/polyline.rb