Sha256: bdab7d66ae5d8e21c6fc467442bfe32675c74b0fff5d6c53115be90cdaba7a01

Contents?: true

Size: 1.3 KB

Versions: 11

Compression:

Stored size: 1.3 KB

Contents

require_relative '../base_line'
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 points
        [
          Matrix.column_vector([ x + side_size*2*units, y ]),
          Matrix.column_vector([ x + side_size*4*units, y + side_size*units ]),
          Matrix.column_vector([ x + side_size*2*units, y + side_size*2*units ]),
          Matrix.column_vector([ x, y + side_size*units ])
        ]
      end 
  
      def rows
        Array.new(side_size) do |i|
          a = Matrix.column_vector([
            x + 2*units,
            y + (2*i+1)*units,
          ])

          b = Matrix.column_vector([
            x + 6*units,
            y + (2*i+1)*units
          ])

          GridGenerator::BaseLine.new(a: a, b: b) 
        end
      end
  
      def columns
        Array.new(side_size) do |i|
          a = Matrix.column_vector([
            x + (4*i+2)*units,
            y + units,
          ])

          b = Matrix.column_vector([
            x + (4*i+2)*units,
            y + 3*units
          ])

          GridGenerator::BaseLine.new(a: a, b: b) 
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
grid_generator-0.5.3 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.5.2 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.5.1 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.5.0 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.4.5 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.4.4 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.4.3 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.4.2 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.4.1 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.4.0 lib/grid_generator/skewb/top_skewb_grid.rb
grid_generator-0.3.3 lib/grid_generator/skewb/top_skewb_grid.rb