Class: SimplePolygons::Rectangle

Inherits:
Polygon
  • Object
show all
Defined in:
lib/simple-polygons.rb

Overview

Represents a rectangle.

Direct Known Subclasses

Square

Instance Method Summary collapse

Methods inherited from Polygon

#number_of_points

Constructor Details

#initialize(start_loc, length, width) ⇒ Rectangle

Makes a new rectangle with the specified boundaries. start_loc should be a Location object and length and width parameters should be floats.



51
52
53
# File 'lib/simple-polygons.rb', line 51

def initialize(start_loc, length, width)
  super([start_loc, Location.new(start_loc.x() + length, start_loc.y() + width)])
end