Skip to contents

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.

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.

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