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

Instance Method Details

#apexArray<Integer, Integer> Also known as: summit

The point farthest away from a rectangle’s base.

Returns:

  • (Array<Integer, Integer>)


12
13
14
# File 'tomes/spells/geometry/apex.rb', line 12

def apex
  [apex_x, apex_y]
end

#apex_xObject

The X coordinate farthest away from its base.

Returns:

  • Integer



19
20
21
# File 'tomes/spells/geometry/apex.rb', line 19

def apex_x
  x + width
end

#apex_yObject

The Y coordinate farthest away from its base.

Returns:

  • Integer



25
26
27
# File 'tomes/spells/geometry/apex.rb', line 25

def apex_y
  y + height
end