Class: GridGenerator::Skewb::TopGrid
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/grid_generator/skewb/top_grid.rb', line 38
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
|
#points ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'lib/grid_generator/skewb/top_grid.rb', line 13
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
|
#rows ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/grid_generator/skewb/top_grid.rb', line 22
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
|