Function reference
Geometry types
polyclid extents euclid by providing the following basic types that models polygons and polylines in 2 dimensions. The types are designed to resemble the basic geometries provided by euclid as much as possible and will respond to the same basic methods.
-
polygon()
is_polygon()
as_polygon()
- Vector of polygons
-
polygon_set()
is_polygon_set()
as_polygon_set()
n_polygons()
locate_polygon()
n_faces()
vert_degree()
vert_neighbors()
polyline_verts()
- Sets of polygons
-
polyline()
is_polyline()
as_polyline()
- Vector of polylines
-
polyline_set()
is_polyline_set()
as_polyline_set()
n_polylines()
- Sets of polylines
Boolean operations
One of the major classes of functionality that polyclid provides are support for all boolean operations between polygons and polylines.
-
poly_bool
- Boolean set operations on polygons and polylines
Polygon partitioning
Partitioning polygons into convex parts or triangles are important for many algorithms as solutions to concave polygons can often be found by solving the problem for its subparts (e.g. finding the controid of a polygon).
-
partition_convex()
partition_monotone()
- Partition polygons into triangles or convex polygons
Predicates
polyclid provides a set of predicates about it’s types to inspect various properties of them.
-
is_valid()
make_valid()
- Polygon validity
-
is_convex()
is_simple()
is_relatively_simple()
- Polygon topology
-
is_monotone()
is_weakly_monotone()
is_selfintersecting()
- Polyline monotonicity
-
reverse_orientation()
is_clockwise()
is_counterclockwise()
- Polygon orientation
Manipulation and extraction
Apart from the basic vert()
, and edge()
polyclid provides a set of functions for extracting and manipulating the geometries it supports.
-
n_holes()
is_unbounded()
boundary()
`boundary<-`()
hole()
`hole<-`()
n_rings()
rings()
connect_holes()
- Polygon rings
-
reverse_orientation()
is_clockwise()
is_counterclockwise()
- Polygon orientation
-
connect_polylines()
- Connect polylines together to a single line
-
vert_insert()
- Insert vertices into a polyline or polygon
Measures
Polyclid provides methods for a range of euclids measures, such as approx_area()
, approx_length()
, centroid()
etc, but also provides a selection of new measures.
-
approx_vert_angle()
- Calculate angle at vertices of polylines or polygons
-
approx_vert_normal()
- Calculate vertex normals of a polyline or polygon
Data
It is often good to have some complex polygons to try out stuff with so polyclid comes with a high resolution encoding of Denmark.
-
denmark()
- Dataset of boundaries for Denmark