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.2.9 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.8 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.7 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.6 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.5 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.4 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.3 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.2 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.1 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.2.0 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.12 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.11 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.10 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.9 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.8 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.7 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.6 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.5 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.4 lib/grid_generator/skewb/right_skewb_grid.rb
grid_generator-0.1.3 lib/grid_generator/skewb/right_skewb_grid.rb