Geometry types

The core of euclid is a range of new primitive vector types modelling different types of geometries. When applicable, the types comes in both a 2 and 3 dimensional version. The vector types behaves much like regular R vectors in terms of subsetting, equality, etc. When it makes sense they also respond to arithmetic and sorting operations.

is_geometry() geometry_type() cardinality() definition_names()

Vector of geometries

is_surface() is_volume() is_curve() is_arrow() is_location()

Query geometry class

circle() is_circle() as_circle()

Vector of circles

direction() is_direction() between() as_direction()

Vector of directions

iso_cube() is_iso_cube() as_iso_cube()

Vector of iso cubes

iso_rect() is_iso_rect() as_iso_rect()

Vector of iso rectangles

line() is_line() as_line()

Vector of lines

plane() is_plane() as_plane()

Vector of planes

point() is_point() as_point()

Vector of points

ray() is_ray() as_ray() is_segment()

Vector of rays

segment() as_segment()

Vector of segments

sphere() is_sphere() as_sphere()

Vector of spheres

tetrahedron() is_tetrahedron() as_tetrahedron()

Vector of tetrahedrons

triangle() is_triangle() as_triangle()

Vector of triangles

vec() is_vec() as_vec()

Vector of vectors

weighted_point() is_weighted_point() as_weighted_point()

Vector of weighted points

Other data types

In addition to vectors of geometries euclid also provides a few other primitive types to support geometric operations. As with the vectors of geometries, these data types behaves much like normal R vectors.

exact_numeric() is_exact_numeric() as_exact_numeric()

Exact numeric representation

bbox() is_bbox() as_bbox() is_overlapping() `%overlaps%`

Create a vector of bounding boxes

affine_identity() affine_matrix() affine_translate() affine_scale() affine_rotate() is_affine_transformation() as_affine_transformation() inverse() is_reflecting()

Create affine transformation matrices

Data access

Geometries are based on parameters and sometimes supporting points. These can be extracted in various ways.


Access the exact values that defines the geometries


Extract points from geometries


At the core of a lot of geometric algorithms lies predicates on geometries. This is also a place where floating points often leads to failures since e.g. a point constructed to lie on a plane may end up slightly off the plane due to rounding and imprecisions. The euclid predicates are exact, however, as long as the geometries have been constructed within the framework.


Check if a geometry is degenerate

has_on() `%is_on%` has_inside() `%is_inside%` has_outside() `%is_outside%` has_on_positive_side() `%is_on_positive_side%` has_on_negative_side() `%is_on_negative_side%`

Query location of points relative to geometry

is_constant_in() has_constant_x() has_constant_y() has_constant_z()

Check geometries for axis alignment

has_intersection() `%is_intersecting%`

Query whether geometries intersect


Check geometries for parallelity

collinear() coplanar()

Check geometries for whether they are collinear or coplanar

in_order() in_order_along()

Check whether points are collinear and ordered along the line

turns_left() turns_right() turn_along()

Query the side of the turn constructed by three consecutive points


Geometries can be transformed by affine transformation matrices using the transform() method. In addition, other types of transformations are available, such as projections to lines and planes.


Project geometries to lines and planes


Map 3D geometries to 2D based on plane


Get the normal of a geometry


Intersection of geometries is at the heart of many algorithms and is complicated by their unpredictable output type. Further, not all intersections can be represented exactly.

intersection() intersection_circle() intersection_iso_rect() intersection_plane() intersection_point() intersection_line() intersection_ray() intersection_segment() intersection_sphere() intersection_triangle()

Calculate intersections between geometries

has_intersection() `%is_intersecting%`

Query whether geometries intersect


Measures on geometries such as area, length, and volume, cannot always be given in exact numbers due to reliance on square roots, pi, and other inexact operations. Because of this they are here provided as approximate measures in the sense that they are subjected to the imprecisions of floating point arithmetic. Further, pairwise measures such as distance is given as well.

approx_length() approx_area() approx_volume() approx_radius()

Approximate geometry measures

distance_squared() approx_distance_matrix()

Calculate distances between geometries


Calculate angle between geometries


Single geometries or collections of them can define specific locations in space, often points, but also lines and planes. euclid provides a range of functionality for calculating these.


Calculate the centroid of a geometry or a set of points


Calculate circumcenter of triangles, tetrahedrons, or sets of points


Calculate barycenter of a set of weighted points


Calculate the bisector of two geometries


Construct the equidistant line of 2 or three points


Calculate radical point, line, or plane of two circles or spheres