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.
- Vector of geometries
- Query geometry class
- Vector of circles
- Vector of directions
- Vector of iso cubes
- Vector of iso rectangles
- Vector of planes
- Vector of points
- Vector of segments
- Vector of spheres
- Vector of tetrahedrons
- Vector of triangles
- 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 representation
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 vertices and edges 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
- Query location of points relative to geometry
- Check geometries for axis alignment
- Query whether geometries intersect
- Check geometries for parallelity
- Check geometries for whether they are collinear or coplanar
- Check whether points are collinear and ordered along the line
- 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.
- Calculate intersections between geometries
- Query whether geometries intersect
While euclid only provides intersection methods for its data types it provides generics that can be used by extension packages to add onto it. See e.g. the polyclid package that provides the full set of 2D boolean set operations for polygons and polylines.
- Boolean operations on geometries
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.
- Approximate geometry measures
- 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
Geometry and drawing goes hand in hand. Euclid provides direct support for both base and grid graphics when it comes to 2D geometries. 3D geometries is not supported at the moment, but will be in the future.
- Plotting functions for geometries