Method: Geometry::Polygon#initialize
- Defined in:
- lib/geometry/polygon.rb
#initialize(Edge, Edge, ...) ⇒ Polygon #initialize(Point, Point, ...) ⇒ Polygon
Construct a new Polygon from Points and/or Edges
The constructor will try to convert all of its arguments into Points and
Edges. Then successive Points will be collpased into Edges. Successive
Edges that share a common vertex will be added to the new Polygon. If
there's a gap between Edges it will be automatically filled with a new
Edge. The resulting Polygon will then be closed if it isn't already.
30 31 32 33 |
# File 'lib/geometry/polygon.rb', line 30 def initialize(*args) super close! # A Polygon is always closed end |