Class: GridGenerator::Skewb::RightGrid
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/right_grid.rb', line 38
def columns
Array.new(side_size) do |i|
a = Matrix.column_vector([
x + (2*i)*units,
y + (-3*i+4)*units,
])
b = Matrix.column_vector([
x + (i+1)*2*units,
y + (-3*i+5)*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/right_grid.rb', line 13
def points
[
Matrix.column_vector([ x, y + side_size*units ]),
Matrix.column_vector([ x + side_size*2*units, y ]),
Matrix.column_vector([ x + side_size*2*units, y + side_size*2*units ]),
Matrix.column_vector([ x, y + side_size*3*units ])
]
end
|
#rows ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/grid_generator/skewb/right_grid.rb', line 22
def rows
Array.new(side_size) do |i|
a = Matrix.column_vector([
x + (2*i)*units,
y + (i+4)*units,
])
b = Matrix.column_vector([
x + (2*i+2)*units,
y + (i+1)*units
])
GridGenerator::BaseLine.new(a: a, b: b)
end
end
|