Class: GridGenerator::Cubic::FacingSquareFactory
- Inherits:
-
Object
- Object
- GridGenerator::Cubic::FacingSquareFactory
- Defined in:
- lib/grid_generator/cubic/facing_square_factory.rb
Instance Attribute Summary collapse
-
#colour ⇒ Object
readonly
Returns the value of attribute colour.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#opacity ⇒ Object
readonly
Returns the value of attribute opacity.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(x:, y:, width:, height:, colour:, opacity:) ⇒ FacingSquareFactory
constructor
A new instance of FacingSquareFactory.
- #max_x ⇒ Object
- #max_y ⇒ Object
- #points ⇒ Object
Constructor Details
#initialize(x:, y:, width:, height:, colour:, opacity:) ⇒ FacingSquareFactory
Returns a new instance of FacingSquareFactory.
6 7 8 9 10 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 6 def initialize(x: , y:, width:, height:, colour:, opacity:) @x, @y = x, y @width, @height = width, height @colour, @opacity = colour, opacity end |
Instance Attribute Details
#colour ⇒ Object (readonly)
Returns the value of attribute colour.
12 13 14 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 12 def colour @colour end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
12 13 14 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 12 def height @height end |
#opacity ⇒ Object (readonly)
Returns the value of attribute opacity.
12 13 14 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 12 def opacity @opacity end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
12 13 14 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 12 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
12 13 14 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 12 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
12 13 14 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 12 def y @y end |
Instance Method Details
#build ⇒ Object
31 32 33 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 31 def build GridGenerator::BaseElement.new(points: points, colour: colour, opacity: opacity) end |
#max_x ⇒ Object
14 15 16 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 14 def max_x x + width end |
#max_y ⇒ Object
18 19 20 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 18 def max_y y + height end |
#points ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/grid_generator/cubic/facing_square_factory.rb', line 22 def points [ Matrix.column_vector([ x, y ]), Matrix.column_vector([ max_x, y ]), Matrix.column_vector([ max_x, max_y ]), Matrix.column_vector([ x, max_y ]) ] end |