Class: GridGenerator::Skewb::LeftGrid
Constant Summary
Constants inherited
from SkewbGrid
SkewbGrid::COLOURS
Instance Attribute Summary
Attributes inherited from SkewbGrid
#elements, #units, #x, #y
Instance Method Summary
collapse
Methods inherited from SkewbGrid
#base_shape, #base_shape_style, #build_element, #element_shapes, #initialize, #side_size, #to_svg
Instance Method Details
#columns ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/grid_generator/skewb/left_grid.rb', line 37
def columns
Array.new(side_size) do |i|
a = Matrix.column_vector([
x + (2*i)*units,
y + (-1*i+2)*units,
])
b = Matrix.column_vector([
x + (i+1)*2*units,
y + (-1*i+5)*units
])
GridGenerator::BaseLine.new(a: a, b: b)
end
end
|
#points ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'lib/grid_generator/skewb/left_grid.rb', line 12
def points
[
Matrix.column_vector([ x, y ]),
Matrix.column_vector([ x + side_size*2*units, y + side_size*units ]),
Matrix.column_vector([ x + side_size*2*units, y + side_size*3*units ]),
Matrix.column_vector([ x, y + side_size*2*units ])
]
end
|
#rows ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/grid_generator/skewb/left_grid.rb', line 21
def rows
Array.new(side_size) do |i|
a = Matrix.column_vector([
x + (2*i)*units,
y + (3*i+2)*units,
])
b = Matrix.column_vector([
x + (2*i+2)*units,
y + (3*i+1)*units
])
GridGenerator::BaseLine.new(a: a, b: b)
end
end
|