Module: Apex
- Included in:
- Dimensions
- Defined in:
- tomes/spells/geometry/apex.rb
Overview
This module contains methods for an rectangle’s geometric summit, or “apex” (the point farthest away from its origin). For example: a square of length 10 located at point (0, 0)--that is, its bottom-left corner is at that point-- will have an apex of (10, 10).
Instance Method Summary collapse
-
#apex ⇒ Array<Integer, Integer>
(also: #summit)
The point farthest away from a rectangle’s base.
-
#apex_x ⇒ Object
The X coordinate farthest away from its base.
-
#apex_y ⇒ Object
The Y coordinate farthest away from its base.
Instance Method Details
#apex ⇒ Array<Integer, Integer> Also known as: summit
The point farthest away from a rectangle’s base.
12 13 14 |
# File 'tomes/spells/geometry/apex.rb', line 12 def apex [apex_x, apex_y] end |
#apex_x ⇒ Object
The X coordinate farthest away from its base.
19 20 21 |
# File 'tomes/spells/geometry/apex.rb', line 19 def apex_x x + width end |
#apex_y ⇒ Object
The Y coordinate farthest away from its base.
25 26 27 |
# File 'tomes/spells/geometry/apex.rb', line 25 def apex_y y + height end |