Sha256: 28db39c3a465fc424437e32a21b1438dab7a19848dd2919f6472d97d16a8ec47

Contents?: true

Size: 1.04 KB

Versions: 21

Compression:

Stored size: 1.04 KB

Contents

require_relative '../base_element'
require_relative 'skewb_grid.rb'
require_relative 'right_element_factory.rb'

module GridGenerator
  module Skewb
    class RightSkewbGrid < Skewb::SkewbGrid
      def factory_class
        GridGenerator::Skewb::RightElementFactory
      end
  
      def border_points
        [
          [ x, y + side_size*units ],
          [ x + side_size*2*units, y ],
          [ x + side_size*2*units, y + side_size*2*units ],
          [ x, y + side_size*3*units ]
        ]
      end 
  
      def rows
        Array.new(side_size) do |i|
          GridGenerator::BaseLine.new( 
            x1: x + (2*i)*units,
            y1: y + (i+4)*units,
            x2: x + (2*i+2)*units,
            y2: y + (i+1)*units
          ) 
        end
      end
  
      def columns
        Array.new(side_size) do |i|
          GridGenerator::BaseLine.new( 
            x1: x + (2*i)*units,
            y1: y + (-3*i+4)*units,
            x2: x + (i+1)*2*units,
            y2: y + (-3*i+5)*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/right_skewb_grid.rb