grid_generator 0.2.8 → 0.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/grid_generator/cubic/bordered_grid.rb +24 -12
- data/lib/grid_generator/cubic/facing_grid.rb +24 -13
- data/lib/grid_generator/cubic/grid.rb +23 -13
- data/lib/grid_generator/line.rb +32 -0
- data/lib/grid_generator/megaminx/face_projection.rb +34 -14
- data/lib/grid_generator/pyraminx/face.rb +4 -18
- data/lib/grid_generator/skewb/left_skewb_grid.rb +23 -13
- data/lib/grid_generator/skewb/right_skewb_grid.rb +23 -12
- data/lib/grid_generator/skewb/top_skewb_grid.rb +23 -12
- data/lib/grid_generator/square_one/face.rb +23 -13
- data/lib/grid_generator/version.rb +1 -1
- metadata +2 -2
- data/lib/grid_generator/base_line.rb +0 -26
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9d34bf3e232b6ba728e1dfb968dc9f176932955a8ef93d9b796c5233f6ed495d
         | 
| 4 | 
            +
              data.tar.gz: f135d7666604b09947e3be7465bdeb4831b8d1b0d49aca20ee4d17346fa53e61
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 12f2aea851e3975e67ba4ed59451f6810f1f6c9b7cecee1cac673139b1fb3c76ae2b70b8bb0b37d9bee41fd198674308536c1ae74aa657a3de9f1055c1cec034
         | 
| 7 | 
            +
              data.tar.gz: dd555ce643c53dda16d03d49e6373f140cbedd6fcaccbf2a53447b72a68c781d144b6b78d4be362d7e830ce539b4b44d9a27d19b530a958f9af8f2f2d6287ec8
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -1,3 +1,5 @@ | |
| 1 | 
            +
            require 'matrix'
         | 
| 2 | 
            +
            require_relative '../line'
         | 
| 1 3 | 
             
            require_relative '../face_parser'
         | 
| 2 4 | 
             
            require_relative 'facing_square_factory'
         | 
| 3 5 |  | 
| @@ -73,23 +75,33 @@ module GridGenerator | |
| 73 75 |  | 
| 74 76 | 
             
                  def rows
         | 
| 75 77 | 
             
                    Array.new(height) do |i|
         | 
| 76 | 
            -
                       | 
| 77 | 
            -
                         | 
| 78 | 
            -
                         | 
| 79 | 
            -
             | 
| 80 | 
            -
             | 
| 81 | 
            -
                       | 
| 78 | 
            +
                      a = Matrix.column_vector([
         | 
| 79 | 
            +
                        x,
         | 
| 80 | 
            +
                        unit_y(i+1),
         | 
| 81 | 
            +
                      ])
         | 
| 82 | 
            +
             | 
| 83 | 
            +
                      b = Matrix.column_vector([
         | 
| 84 | 
            +
                        max_x,
         | 
| 85 | 
            +
                        unit_y(i+1)
         | 
| 86 | 
            +
                      ])
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                      GridGenerator::Line.new(a: a, b: b)
         | 
| 82 89 | 
             
                    end
         | 
| 83 90 | 
             
                  end
         | 
| 84 91 |  | 
| 85 92 | 
             
                  def columns 
         | 
| 86 93 | 
             
                    Array.new(width) do |i|
         | 
| 87 | 
            -
                       | 
| 88 | 
            -
                         | 
| 89 | 
            -
                         | 
| 90 | 
            -
             | 
| 91 | 
            -
             | 
| 92 | 
            -
                       | 
| 94 | 
            +
                      a = Matrix.column_vector([
         | 
| 95 | 
            +
                        unit_x(i+1),
         | 
| 96 | 
            +
                        y,
         | 
| 97 | 
            +
                      ])
         | 
| 98 | 
            +
             | 
| 99 | 
            +
                      b = Matrix.column_vector([
         | 
| 100 | 
            +
                        unit_x(i+1),
         | 
| 101 | 
            +
                        max_y
         | 
| 102 | 
            +
                      ])
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                      GridGenerator::Line.new(a: a, b: b)
         | 
| 93 105 | 
             
                    end
         | 
| 94 106 | 
             
                  end
         | 
| 95 107 |  | 
| @@ -1,5 +1,6 @@ | |
| 1 | 
            +
            require 'matrix'
         | 
| 1 2 | 
             
            require_relative '../face_parser'
         | 
| 2 | 
            -
            require_relative '../ | 
| 3 | 
            +
            require_relative '../line'
         | 
| 3 4 | 
             
            require_relative 'facing_square_factory'
         | 
| 4 5 |  | 
| 5 6 | 
             
            module GridGenerator
         | 
| @@ -54,23 +55,33 @@ module GridGenerator | |
| 54 55 |  | 
| 55 56 | 
             
                  def rows
         | 
| 56 57 | 
             
                    Array.new(height) do |i|
         | 
| 57 | 
            -
                       | 
| 58 | 
            -
                         | 
| 59 | 
            -
                         | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
                       | 
| 58 | 
            +
                      a = Matrix.column_vector([
         | 
| 59 | 
            +
                        x,
         | 
| 60 | 
            +
                        unit_y(i+1),
         | 
| 61 | 
            +
                      ])
         | 
| 62 | 
            +
             | 
| 63 | 
            +
                      b = Matrix.column_vector([
         | 
| 64 | 
            +
                        max_x,
         | 
| 65 | 
            +
                        unit_y(i+1)
         | 
| 66 | 
            +
                      ])
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 63 69 | 
             
                    end
         | 
| 64 70 | 
             
                  end
         | 
| 65 71 |  | 
| 66 72 | 
             
                  def columns 
         | 
| 67 73 | 
             
                    Array.new(width) do |i|
         | 
| 68 | 
            -
                       | 
| 69 | 
            -
                         | 
| 70 | 
            -
                         | 
| 71 | 
            -
             | 
| 72 | 
            -
             | 
| 73 | 
            -
                       | 
| 74 | 
            +
                      a = Matrix.column_vector([
         | 
| 75 | 
            +
                        unit_x(i+1),
         | 
| 76 | 
            +
                        y,
         | 
| 77 | 
            +
                      ])
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                      b = Matrix.column_vector([
         | 
| 80 | 
            +
                        unit_x(i+1),
         | 
| 81 | 
            +
                        max_y
         | 
| 82 | 
            +
                      ])
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                      GridGenerator::Line.new(a: a, b: b)
         | 
| 74 85 | 
             
                    end
         | 
| 75 86 | 
             
                  end
         | 
| 76 87 |  | 
| @@ -1,5 +1,5 @@ | |
| 1 1 | 
             
            require 'matrix'
         | 
| 2 | 
            -
            require_relative '../ | 
| 2 | 
            +
            require_relative '../line'
         | 
| 3 3 |  | 
| 4 4 | 
             
            module GridGenerator
         | 
| 5 5 | 
             
              module Cubic
         | 
| @@ -93,23 +93,33 @@ module GridGenerator | |
| 93 93 |  | 
| 94 94 | 
             
                  def rows
         | 
| 95 95 | 
             
                    Array.new(height) do |i|
         | 
| 96 | 
            -
                       | 
| 97 | 
            -
                         | 
| 98 | 
            -
                         | 
| 99 | 
            -
             | 
| 100 | 
            -
             | 
| 101 | 
            -
                       | 
| 96 | 
            +
                      a = Matrix.column_vector([
         | 
| 97 | 
            +
                        row_line_start(i+1)[0,0],
         | 
| 98 | 
            +
                        row_line_start(i+1)[1,0],
         | 
| 99 | 
            +
                      ])
         | 
| 100 | 
            +
             | 
| 101 | 
            +
                      b = Matrix.column_vector([
         | 
| 102 | 
            +
                        row_line_end(i+1)[0,0],
         | 
| 103 | 
            +
                        row_line_end(i+1)[1,0]
         | 
| 104 | 
            +
                      ])
         | 
| 105 | 
            +
             | 
| 106 | 
            +
                      GridGenerator::Line.new(a: a, b: b)
         | 
| 102 107 | 
             
                    end
         | 
| 103 108 | 
             
                  end
         | 
| 104 109 |  | 
| 105 110 | 
             
                  def columns 
         | 
| 106 111 | 
             
                    Array.new(width) do |i|
         | 
| 107 | 
            -
                       | 
| 108 | 
            -
                         | 
| 109 | 
            -
                         | 
| 110 | 
            -
             | 
| 111 | 
            -
             | 
| 112 | 
            -
                       | 
| 112 | 
            +
                      a = Matrix.column_vector([
         | 
| 113 | 
            +
                        column_line_start(i+1)[0,0],
         | 
| 114 | 
            +
                        column_line_start(i+1)[1,0],
         | 
| 115 | 
            +
                      ])
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                      b = Matrix.column_vector([
         | 
| 118 | 
            +
                        column_line_end(i+1)[0,0],
         | 
| 119 | 
            +
                        column_line_end(i+1)[1,0]
         | 
| 120 | 
            +
                      ])
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                      GridGenerator::Line.new(a: a, b: b)
         | 
| 113 123 | 
             
                    end
         | 
| 114 124 | 
             
                  end
         | 
| 115 125 |  | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            module GridGenerator
         | 
| 2 | 
            +
              class Line
         | 
| 3 | 
            +
                def initialize(a:, b:)
         | 
| 4 | 
            +
                  @a, @b = a, b
         | 
| 5 | 
            +
                end
         | 
| 6 | 
            +
             | 
| 7 | 
            +
                attr_reader :a, :b
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                def ==(other)
         | 
| 10 | 
            +
                  self.class == other.class &&
         | 
| 11 | 
            +
                    self.a == other.a &&
         | 
| 12 | 
            +
                    self.b == other.b
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def x1
         | 
| 16 | 
            +
                  a[0,0]
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def y1
         | 
| 20 | 
            +
                  a[1,0]
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                def x2
         | 
| 24 | 
            +
                  b[0,0]
         | 
| 25 | 
            +
                end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                def y2
         | 
| 28 | 
            +
                  b[1,0]
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
            end
         | 
| 32 | 
            +
             | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require 'matrix'
         | 
| 2 2 | 
             
            require_relative '../rotator'
         | 
| 3 3 | 
             
            require_relative '../helper'
         | 
| 4 | 
            +
            require_relative '../line'
         | 
| 4 5 |  | 
| 5 6 | 
             
            module GridGenerator
         | 
| 6 7 | 
             
              module Megaminx
         | 
| @@ -76,21 +77,45 @@ module GridGenerator | |
| 76 77 | 
             
                    end
         | 
| 77 78 | 
             
                  end
         | 
| 78 79 |  | 
| 80 | 
            +
                  def top_right_pentagon_points
         | 
| 81 | 
            +
                    @top_right_pentagon_points ||= [
         | 
| 82 | 
            +
                      decagon_points[0],
         | 
| 83 | 
            +
                      decagon_points[1],
         | 
| 84 | 
            +
                      decagon_points[2],
         | 
| 85 | 
            +
                      pentagon_points[1],
         | 
| 86 | 
            +
                      pentagon_points[0]
         | 
| 87 | 
            +
                    ]
         | 
| 88 | 
            +
                  end
         | 
| 89 | 
            +
             | 
| 79 90 | 
             
                  # for svg 
         | 
| 80 91 | 
             
                  def connecting_lines
         | 
| 81 92 | 
             
                    pentagon_points.each_with_index.map do |p, i|
         | 
| 82 93 | 
             
                      d = decagon_points[i*2]
         | 
| 83 | 
            -
                       | 
| 84 | 
            -
                       | 
| 85 | 
            -
                      GridGenerator:: | 
| 86 | 
            -
             | 
| 87 | 
            -
             | 
| 88 | 
            -
             | 
| 89 | 
            -
             | 
| 90 | 
            -
             | 
| 94 | 
            +
                      line_start = p + offset
         | 
| 95 | 
            +
                      line_end = d + offset
         | 
| 96 | 
            +
                      GridGenerator::Line.new(a: line_start, b: line_end) 
         | 
| 97 | 
            +
                    end
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
                  
         | 
| 100 | 
            +
                  # for svg
         | 
| 101 | 
            +
                  def top_right_face_lines
         | 
| 102 | 
            +
                    (0..4).map do |i| 
         | 
| 103 | 
            +
                      a = top_right_pentagon_points[i]
         | 
| 104 | 
            +
                      b = top_right_pentagon_points[(i+1)%5]
         | 
| 105 | 
            +
                      c = top_right_pentagon_points[(i+2)%5]
         | 
| 106 | 
            +
                      d = top_right_pentagon_points[(i+3)%5]
         | 
| 107 | 
            +
             | 
| 108 | 
            +
                      ab_intervals = GridGenerator::Helper.intervals(a,b,2)
         | 
| 109 | 
            +
                      cd_intervals = GridGenerator::Helper.intervals(c,d,2)
         | 
| 110 | 
            +
             | 
| 111 | 
            +
                      line_start = ab_intervals.last + offset
         | 
| 112 | 
            +
                      line_end = cd_intervals.first + offset
         | 
| 113 | 
            +
             | 
| 114 | 
            +
                      GridGenerator::Line.new(a: line_start, b: line_end)
         | 
| 91 115 | 
             
                    end
         | 
| 92 116 | 
             
                  end
         | 
| 93 117 |  | 
| 118 | 
            +
                  # for svg
         | 
| 94 119 | 
             
                  def front_face_lines
         | 
| 95 120 | 
             
                    (0..4).map do |i| 
         | 
| 96 121 | 
             
                      a = pentagon_points[i]
         | 
| @@ -104,12 +129,7 @@ module GridGenerator | |
| 104 129 | 
             
                      line_start = ab_intervals.last + offset
         | 
| 105 130 | 
             
                      line_end = cd_intervals.first + offset
         | 
| 106 131 |  | 
| 107 | 
            -
                      GridGenerator:: | 
| 108 | 
            -
                        x1: line_start[0,0],
         | 
| 109 | 
            -
                        y1: line_start[1,0],
         | 
| 110 | 
            -
                        x2: line_end[0,0],
         | 
| 111 | 
            -
                        y2: line_end[1,0]
         | 
| 112 | 
            -
                      )
         | 
| 132 | 
            +
                      GridGenerator::Line.new(a: line_start, b: line_end)
         | 
| 113 133 | 
             
                    end
         | 
| 114 134 | 
             
                  end
         | 
| 115 135 |  | 
| @@ -1,6 +1,7 @@ | |
| 1 1 | 
             
            require_relative 'triangle_factory'
         | 
| 2 2 | 
             
            require_relative '../rotator'
         | 
| 3 3 | 
             
            require_relative '../scaler'
         | 
| 4 | 
            +
            require_relative '../line'
         | 
| 4 5 |  | 
| 5 6 | 
             
            module GridGenerator
         | 
| 6 7 | 
             
              module Pyraminx
         | 
| @@ -78,12 +79,7 @@ module GridGenerator | |
| 78 79 | 
             
                      transformed_1 = rotator.rotate(scaled_1) + offset
         | 
| 79 80 | 
             
                      transformed_2 = rotator.rotate(scaled_2) + offset
         | 
| 80 81 |  | 
| 81 | 
            -
                      GridGenerator:: | 
| 82 | 
            -
                        x1: transformed_1[0,0],
         | 
| 83 | 
            -
                        y1: transformed_1[1,0],
         | 
| 84 | 
            -
                        x2: transformed_2[0,0],
         | 
| 85 | 
            -
                        y2: transformed_2[1,0]
         | 
| 86 | 
            -
                      )
         | 
| 82 | 
            +
                      GridGenerator::Line.new(a: transformed_1, b: transformed_2) 
         | 
| 87 83 | 
             
                    end
         | 
| 88 84 | 
             
                  end
         | 
| 89 85 |  | 
| @@ -112,12 +108,7 @@ module GridGenerator | |
| 112 108 | 
             
                      transformed_1 = rotator.rotate(scaled_1) + offset
         | 
| 113 109 | 
             
                      transformed_2 = rotator.rotate(scaled_2) + offset
         | 
| 114 110 |  | 
| 115 | 
            -
                      GridGenerator:: | 
| 116 | 
            -
                        x1: transformed_1[0,0],
         | 
| 117 | 
            -
                        y1: transformed_1[1,0],
         | 
| 118 | 
            -
                        x2: transformed_2[0,0],
         | 
| 119 | 
            -
                        y2: transformed_2[1,0]
         | 
| 120 | 
            -
                      )
         | 
| 111 | 
            +
                      GridGenerator::Line.new(a: transformed_1, b: transformed_2) 
         | 
| 121 112 | 
             
                    end
         | 
| 122 113 | 
             
                  end
         | 
| 123 114 |  | 
| @@ -146,12 +137,7 @@ module GridGenerator | |
| 146 137 | 
             
                      transformed_1 = rotator.rotate(scaled_1) + offset
         | 
| 147 138 | 
             
                      transformed_2 = rotator.rotate(scaled_2) + offset
         | 
| 148 139 |  | 
| 149 | 
            -
                      GridGenerator:: | 
| 150 | 
            -
                        x1: transformed_1[0,0],
         | 
| 151 | 
            -
                        y1: transformed_1[1,0],
         | 
| 152 | 
            -
                        x2: transformed_2[0,0],
         | 
| 153 | 
            -
                        y2: transformed_2[1,0]
         | 
| 154 | 
            -
                      )
         | 
| 140 | 
            +
                      GridGenerator::Line.new(a: transformed_1, b: transformed_2) 
         | 
| 155 141 | 
             
                    end
         | 
| 156 142 | 
             
                  end
         | 
| 157 143 |  | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require_relative '../ | 
| 1 | 
            +
            require_relative '../line'
         | 
| 2 2 | 
             
            require_relative 'skewb_grid'
         | 
| 3 3 | 
             
            require_relative 'left_element_factory'
         | 
| 4 4 |  | 
| @@ -20,23 +20,33 @@ module GridGenerator | |
| 20 20 |  | 
| 21 21 | 
             
                  def rows
         | 
| 22 22 | 
             
                    Array.new(side_size) do |i|
         | 
| 23 | 
            -
                       | 
| 24 | 
            -
                         | 
| 25 | 
            -
                         | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
                       | 
| 23 | 
            +
                      a = Matrix.column_vector([
         | 
| 24 | 
            +
                        x + (2*i)*units,
         | 
| 25 | 
            +
                        y + (3*i+2)*units,
         | 
| 26 | 
            +
                      ])
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                      b = Matrix.column_vector([
         | 
| 29 | 
            +
                        x + (2*i+2)*units,
         | 
| 30 | 
            +
                        y + (3*i+1)*units
         | 
| 31 | 
            +
                      ])
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 29 34 | 
             
                    end
         | 
| 30 35 | 
             
                  end
         | 
| 31 36 |  | 
| 32 37 | 
             
                  def columns
         | 
| 33 38 | 
             
                    Array.new(side_size) do |i|
         | 
| 34 | 
            -
                       | 
| 35 | 
            -
                         | 
| 36 | 
            -
                         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                       | 
| 39 | 
            +
                      a = Matrix.column_vector([
         | 
| 40 | 
            +
                        x + (2*i)*units,
         | 
| 41 | 
            +
                        y + (-1*i+2)*units,
         | 
| 42 | 
            +
                      ])
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                      b = Matrix.column_vector([
         | 
| 45 | 
            +
                        x + (i+1)*2*units,
         | 
| 46 | 
            +
                        y + (-1*i+5)*units
         | 
| 47 | 
            +
                      ])
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 40 50 | 
             
                    end
         | 
| 41 51 | 
             
                  end
         | 
| 42 52 | 
             
                end
         | 
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            require_relative '../line'
         | 
| 1 2 | 
             
            require_relative '../base_element'
         | 
| 2 3 | 
             
            require_relative 'skewb_grid.rb'
         | 
| 3 4 | 
             
            require_relative 'right_element_factory.rb'
         | 
| @@ -20,23 +21,33 @@ module GridGenerator | |
| 20 21 |  | 
| 21 22 | 
             
                  def rows
         | 
| 22 23 | 
             
                    Array.new(side_size) do |i|
         | 
| 23 | 
            -
                       | 
| 24 | 
            -
                         | 
| 25 | 
            -
                         | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
                       | 
| 24 | 
            +
                      a = Matrix.column_vector([
         | 
| 25 | 
            +
                        x + (2*i)*units,
         | 
| 26 | 
            +
                        y + (i+4)*units,
         | 
| 27 | 
            +
                      ])
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      b = Matrix.column_vector([
         | 
| 30 | 
            +
                        x + (2*i+2)*units,
         | 
| 31 | 
            +
                        y + (i+1)*units
         | 
| 32 | 
            +
                      ])
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 29 35 | 
             
                    end
         | 
| 30 36 | 
             
                  end
         | 
| 31 37 |  | 
| 32 38 | 
             
                  def columns
         | 
| 33 39 | 
             
                    Array.new(side_size) do |i|
         | 
| 34 | 
            -
                       | 
| 35 | 
            -
                         | 
| 36 | 
            -
                         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                       | 
| 40 | 
            +
                      a = Matrix.column_vector([
         | 
| 41 | 
            +
                        x + (2*i)*units,
         | 
| 42 | 
            +
                        y + (-3*i+4)*units,
         | 
| 43 | 
            +
                      ])
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                      b = Matrix.column_vector([
         | 
| 46 | 
            +
                        x + (i+1)*2*units,
         | 
| 47 | 
            +
                        y + (-3*i+5)*units
         | 
| 48 | 
            +
                      ])
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 40 51 | 
             
                    end
         | 
| 41 52 | 
             
                  end
         | 
| 42 53 | 
             
                end
         | 
| @@ -1,3 +1,4 @@ | |
| 1 | 
            +
            require_relative '../line'
         | 
| 1 2 | 
             
            require_relative '../base_element'
         | 
| 2 3 | 
             
            require_relative 'skewb_grid'
         | 
| 3 4 | 
             
            require_relative 'top_element_factory'
         | 
| @@ -20,23 +21,33 @@ module GridGenerator | |
| 20 21 |  | 
| 21 22 | 
             
                  def rows
         | 
| 22 23 | 
             
                    Array.new(side_size) do |i|
         | 
| 23 | 
            -
                       | 
| 24 | 
            -
                         | 
| 25 | 
            -
                         | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
                       | 
| 24 | 
            +
                      a = Matrix.column_vector([
         | 
| 25 | 
            +
                        x + 2*units,
         | 
| 26 | 
            +
                        y + (2*i+1)*units,
         | 
| 27 | 
            +
                      ])
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      b = Matrix.column_vector([
         | 
| 30 | 
            +
                        x + 6*units,
         | 
| 31 | 
            +
                        y + (2*i+1)*units
         | 
| 32 | 
            +
                      ])
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 29 35 | 
             
                    end
         | 
| 30 36 | 
             
                  end
         | 
| 31 37 |  | 
| 32 38 | 
             
                  def columns
         | 
| 33 39 | 
             
                    Array.new(side_size) do |i|
         | 
| 34 | 
            -
                       | 
| 35 | 
            -
                         | 
| 36 | 
            -
                         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
                       | 
| 40 | 
            +
                      a = Matrix.column_vector([
         | 
| 41 | 
            +
                        x + (4*i+2)*units,
         | 
| 42 | 
            +
                        y + units,
         | 
| 43 | 
            +
                      ])
         | 
| 44 | 
            +
             | 
| 45 | 
            +
                      b = Matrix.column_vector([
         | 
| 46 | 
            +
                        x + (4*i+2)*units,
         | 
| 47 | 
            +
                        y + 3*units
         | 
| 48 | 
            +
                      ])
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                      GridGenerator::Line.new(a: a, b: b) 
         | 
| 40 51 | 
             
                    end
         | 
| 41 52 | 
             
                  end
         | 
| 42 53 | 
             
                end
         | 
| @@ -1,4 +1,4 @@ | |
| 1 | 
            -
            require_relative '../ | 
| 1 | 
            +
            require_relative '../line'
         | 
| 2 2 | 
             
            require_relative '../square_one_face_parser'
         | 
| 3 3 | 
             
            require_relative 'element_factory'
         | 
| 4 4 |  | 
| @@ -42,21 +42,31 @@ module GridGenerator | |
| 42 42 | 
             
                  end
         | 
| 43 43 |  | 
| 44 44 | 
             
                  def forward_axis
         | 
| 45 | 
            -
                     | 
| 46 | 
            -
                       | 
| 47 | 
            -
                       | 
| 48 | 
            -
             | 
| 49 | 
            -
             | 
| 50 | 
            -
                     | 
| 45 | 
            +
                    a = Matrix.column_vector([
         | 
| 46 | 
            +
                      x+half_face_size+half_edge_width,
         | 
| 47 | 
            +
                      y,
         | 
| 48 | 
            +
                    ])
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                    b = Matrix.column_vector([
         | 
| 51 | 
            +
                      x+half_face_size-half_edge_width,
         | 
| 52 | 
            +
                      y+face_size
         | 
| 53 | 
            +
                    ])
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                    GridGenerator::Line.new(a: a, b: b) 
         | 
| 51 56 | 
             
                  end
         | 
| 52 57 |  | 
| 53 58 | 
             
                  def back_axis
         | 
| 54 | 
            -
                     | 
| 55 | 
            -
                       | 
| 56 | 
            -
                       | 
| 57 | 
            -
             | 
| 58 | 
            -
             | 
| 59 | 
            -
                     | 
| 59 | 
            +
                    a = Matrix.column_vector([
         | 
| 60 | 
            +
                      x+half_face_size-half_edge_width,
         | 
| 61 | 
            +
                      y,
         | 
| 62 | 
            +
                    ])
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                    b = Matrix.column_vector([
         | 
| 65 | 
            +
                      x+half_face_size+half_edge_width,
         | 
| 66 | 
            +
                      y+face_size
         | 
| 67 | 
            +
                    ])
         | 
| 68 | 
            +
             | 
| 69 | 
            +
                    GridGenerator::Line.new(a: a, b: b) 
         | 
| 60 70 | 
             
                  end
         | 
| 61 71 |  | 
| 62 72 | 
             
                  def element_shapes
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: grid_generator
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.2. | 
| 4 | 
            +
              version: 0.2.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mark Humphreys
         | 
| @@ -46,7 +46,6 @@ files: | |
| 46 46 | 
             
            - lib/grid_generator/arrows/horizontal_arrow.rb
         | 
| 47 47 | 
             
            - lib/grid_generator/arrows/vertical_arrow.rb
         | 
| 48 48 | 
             
            - lib/grid_generator/base_element.rb
         | 
| 49 | 
            -
            - lib/grid_generator/base_line.rb
         | 
| 50 49 | 
             
            - lib/grid_generator/cubic/bordered_grid.rb
         | 
| 51 50 | 
             
            - lib/grid_generator/cubic/facing_grid.rb
         | 
| 52 51 | 
             
            - lib/grid_generator/cubic/facing_square_factory.rb
         | 
| @@ -59,6 +58,7 @@ files: | |
| 59 58 | 
             
            - lib/grid_generator/cubic/units_factory.rb
         | 
| 60 59 | 
             
            - lib/grid_generator/face_parser.rb
         | 
| 61 60 | 
             
            - lib/grid_generator/helper.rb
         | 
| 61 | 
            +
            - lib/grid_generator/line.rb
         | 
| 62 62 | 
             
            - lib/grid_generator/megaminx/common.rb
         | 
| 63 63 | 
             
            - lib/grid_generator/megaminx/element_factory.rb
         | 
| 64 64 | 
             
            - lib/grid_generator/megaminx/face.rb
         | 
| @@ -1,26 +0,0 @@ | |
| 1 | 
            -
            module GridGenerator
         | 
| 2 | 
            -
              class BaseLine
         | 
| 3 | 
            -
                def initialize(x1:, y1:, x2:, y2:)
         | 
| 4 | 
            -
                  @x1, @y1 = x1, y1
         | 
| 5 | 
            -
                  @x2, @y2 = x2, y2
         | 
| 6 | 
            -
                end
         | 
| 7 | 
            -
             | 
| 8 | 
            -
                attr_reader :x1, :y1, :x2, :y2
         | 
| 9 | 
            -
             | 
| 10 | 
            -
                def ==(other)
         | 
| 11 | 
            -
                  self.x1 == other.x1 &&
         | 
| 12 | 
            -
                    self.y1 == other.y1 &&
         | 
| 13 | 
            -
                    self.x2 == other.x2 &&
         | 
| 14 | 
            -
                    self.y2 == other.y2
         | 
| 15 | 
            -
                end
         | 
| 16 | 
            -
             | 
| 17 | 
            -
                def as_json
         | 
| 18 | 
            -
                  {
         | 
| 19 | 
            -
                    "x1" => x1,
         | 
| 20 | 
            -
                    "y1" => y1,
         | 
| 21 | 
            -
                    "x2" => x2,
         | 
| 22 | 
            -
                    "y2" => y2
         | 
| 23 | 
            -
                  }
         | 
| 24 | 
            -
                end
         | 
| 25 | 
            -
              end
         | 
| 26 | 
            -
            end
         |