Module: Center
- Included in:
- Dimensions
- Defined in:
- tomes/spells/geometry/center.rb
Overview
A module with methods that calculate various center points on a rectangle.
Instance Method Summary collapse
-
#horizontal_center ⇒ Object
(also: #center_x)
The horizontal center coordinate.
-
#true_center ⇒ Array<Integer, Integer>
(also: #center, #center_point)
Calculates the vertical and horizontal center and returns that point as an array.
-
#vertical_center ⇒ Object
(also: #center_y)
The vertical center coordinate.
Instance Method Details
#horizontal_center ⇒ Object Also known as: center_x
The horizontal center coordinate.
18 19 20 |
# File 'tomes/spells/geometry/center.rb', line 18 def horizontal_center x + (width / 2) end |
#true_center ⇒ Array<Integer, Integer> Also known as: center, center_point
Calculates the vertical and horizontal center and returns that point as an array.
10 11 12 |
# File 'tomes/spells/geometry/center.rb', line 10 def true_center [horizontal_center, vertical_center] end |
#vertical_center ⇒ Object Also known as: center_y
The vertical center coordinate.
25 26 27 |
# File 'tomes/spells/geometry/center.rb', line 25 def vertical_center y + (height / 2) end |