EasyGeometry::D2::Polygon
A two-dimensional polygon.
.new(*args)
Parameters:
args - sequence of
EasyGeometry::D2::Point
or Array of Numeric(coordinates)
Returns:
EasyGeometry::D2::Polygon
Errors:
raise TypeError if args is not sequence of Points or Arrays of coordinates
raise ArgumentError if args.length < 3 EasyGeometry::D2::Polygon.new([0, 0], [1, 0], [5, 1], [0, 1]).is_right?(a, b, c)
Parameters:
a, b, c - EasyGeometry::D2::Point or Array of Numeric(coordinates)
Returns:
boolean (true or false)
Errors:
raise TypeError if a or b or c is not a PointEasyGeometry::D2::Polygon.is_right?([0, 0], [1, 1], [1, 0]) # true#==(other)
Parameters:
other - GeometryEntity(Point, Line etc.)
Returns:
boolean (true or false)
Errors:poly1 = EasyGeometry::D2::Polygon.new([0, 0], [3, -1], [6, 0], [4, 5], [2, 3], [0, 3])
poly2 = EasyGeometry::D2::Polygon.new([6, 0], [3, -1], [0, 0], [0, 3], [2, 3], [4, 5])
poly1 == poly1 # true
poly1 == poly2 # true#area
Parameters:
Returns:
Numeric
Errors:poly1 = EasyGeometry::D2::Polygon.new([0, 0], [3, -1], [6, 0], [4, 5], [2, 3], [0, 3])
poly1.area # 22#perimeter
#centroid
#sides
#bounds
#is_convex?
#is_encloses_point?(point)
#intersection?(entity)
#distance(other)
Last updated