Class: Sevgi::Geometry::Polygon
- Inherits:
-
PolygonBase
- Object
- Sevgi::Geometry::Polygon
- Defined in:
- lib/sevgi/geometry/elements/polygon.rb
Overview
Variable-size closed lined element with at least three vertices.
Class Method Summary collapse
-
.[](*segments, position: Origin) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary segments.
-
.call(*points) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary points.
-
.from_points(*points) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary points.
-
.from_segments(*segments, position: Origin) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary segments.
Instance Method Summary collapse
-
#perimeter ⇒ Float
Returns the closed path perimeter.
Class Method Details
.[](*segments, position: Origin) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary segments.
46 47 48 49 50 51 52 |
# File 'lib/sevgi/geometry/elements/polygon.rb', line 46 class Polygon < PolygonBase private def validate_geometry! Error.("Polygon requires at least three vertices") if points.size < 4 end end |
.call(*points) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary points.
46 47 48 49 50 51 52 |
# File 'lib/sevgi/geometry/elements/polygon.rb', line 46 class Polygon < PolygonBase private def validate_geometry! Error.("Polygon requires at least three vertices") if points.size < 4 end end |
.from_points(*points) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary points.
46 47 48 49 50 51 52 |
# File 'lib/sevgi/geometry/elements/polygon.rb', line 46 class Polygon < PolygonBase private def validate_geometry! Error.("Polygon requires at least three vertices") if points.size < 4 end end |
.from_segments(*segments, position: Origin) ⇒ Sevgi::Geometry::Polygon
Builds a polygon from boundary segments.
46 47 48 49 50 51 52 |
# File 'lib/sevgi/geometry/elements/polygon.rb', line 46 class Polygon < PolygonBase private def validate_geometry! Error.("Polygon requires at least three vertices") if points.size < 4 end end |