Sha256: b76e79a6d341e53607eeb4f39396b92d604e50e1cad180ad8cdbafcd35dd4b7a

Contents?: true

Size: 1.02 KB

Versions: 21

Compression:

Stored size: 1.02 KB

Contents

require_relative '../base_element'
require_relative 'skewb_grid'
require_relative 'top_element_factory'

module GridGenerator
  module Skewb
    class TopSkewbGrid < Skewb::SkewbGrid
      def factory_class
        GridGenerator::Skewb::TopElementFactory
      end
  
      def border_points
        [
          [ x + side_size*2*units, y ],
          [ x + side_size*4*units, y + side_size*units ],
          [ x + side_size*2*units, y + side_size*2*units ],
          [ x, y + side_size*units ]
        ]
      end 
  
      def rows
        Array.new(side_size) do |i|
          GridGenerator::BaseLine.new( 
            x1: x + 2*units,
            y1: y + (2*i+1)*units,
            x2: x + 6*units,
            y2: y + (2*i+1)*units
          ) 
        end
      end
  
      def columns
        Array.new(side_size) do |i|
          GridGenerator::BaseLine.new( 
            x1: x + (4*i+2)*units,
            y1: y + units,
            x2: x + (4*i+2)*units,
            y2: y + 3*units
          ) 
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
grid_generator-0.1.2 lib/grid_generator/skewb/top_skewb_grid.rb