///|
test "normalize a triangle boundary" {
let triangle = Triangle::ccw(
Coord(0.0, 0.0),
Coord(0.0, 6.0),
Coord(4.0, 0.0),
)
let boundary = triangle.to_polygon().exterior().coords()
@test.assert_eq(boundary, [
Coord(0.0, 0.0),
Coord(4.0, 0.0),
Coord(0.0, 6.0),
Coord(0.0, 0.0),
])
}pub(open) trait HasLength {
fn length(Self) -> Int
}pub(open) trait IsClosed {
fn is_closed(Self) -> Bool
}pub(open) trait IsEmpty {
fn is_empty(Self) -> Bool
}pub(all) enum Geometry {
Point(Point)
Line(Line)
LineString(LineString)
Polygon(Polygon)
MultiPoint(MultiPoint)
MultiLineString(MultiLineString)
MultiPolygon(MultiPolygon)
GeometryCollection(GeometryCollection)
Rect(Rect)
Triangle(Triangle)
} derive(Eq, Debug)fn Geometry::try_into_geometry_collection(self : Geometry) -> GeometryCollection raise MismatchedGeometryfn Geometry::try_into_multi_line_string(self : Geometry) -> MultiLineString raise MismatchedGeometryimpl HasLength for GeometryCollectionimpl IsEmpty for GeometryCollectionimpl HasLength for LineStringimpl IsClosed for LineStringimpl IsEmpty for LineStringimpl HasLength for MultiLineStringimpl IsClosed for MultiLineStringimpl IsEmpty for MultiLineStringimpl HasLength for MultiPointimpl IsEmpty for MultiPointimpl HasLength for MultiPolygonimpl IsEmpty for MultiPolygonInstall
Download zipMoonBit port of georust/geo: 2D planar geospatial primitives and algorithms