geometry
Classes
Primitives
A vector is defined by XYZ components and a homogenisation factor. 

A point is defined by XYZ coordinates. 

A line is defined by two points. 

A polyline is a sequence of points connected by line segments. 

Compute the vertices and faces of one of the Platonic solids. 

An object representing an ordered collection of points in space connected by straight line segments forming a closed boundary around the interior space. 

A plane is defined by a base point and a normal vector. 

A frame is defined by a base point and two orthonormal base vectors. 

A circle is defined by a plane and a radius. 

A box is defined by a frame and its dimensions along the frame’s x, y and zaxes. 

A Bezier curve. 
XForms
The 



Creates a translation transformation. 

Creates a scaling transformation. 

Creates a 

Constructs a 
Other
A tree for nearest neighbor search in a kdimensional space. 
Functions
The functions in this section take various geometric primitives as input parameters. These primitives may be passed into those functions as instances of the corresponding classes or as an equivalent representation using (combinations of) builtin Python objects. The following table defines those equivalent representations.
parameter 
representation 

vector 
list of XYZ coordinates. 
point 
list of XYZ coordinates. 
segment 
2tuple of points. 
line 
2tuple of points. 
ray 
2tuple of points. 
polyline 
list of points. 
polygon 
list of points. 
plane 
2tuple of origin (point) and normal (vector). 
frame 
3tuple of origin (point), U axis (vector) and V axis (vector). 
circle 
3tuple of center (point), normal (vector) and radius (float). 
Note
Many functions have an _xy
variant.
These variants ignore the Zcomponent of the input parameters.
Therefore, they also accept 2D representations of geometric objects.
However, always return a 3D result in the XY plane (with z = 0
).
For example, scale_vector_xy
accepts both 2D and 3D vectors,
but always returns a 3D vector with the Zcomponent set to zero.
Angles
Compute the smallest angle between the vectors defined by three points. 

Compute the smallest angle between the vectors defined by the XY components of three points. 

Compute the smallest angle between two vectors. 

Compute the smallest angle between the XY components of two vectors. 

Compute the two angles between two vectors defined by three points. 

Compute the two angles between the two vectors defined by the XY components of three points. 

Compute the the 2 angles formed by a pair of vectors. 

Compute the angles between the XY components of two vectors. 
Average
Compute the centroid of a set of points. 

Compute the centroid of a set of points lying in the XYplane. 

Compute the centroid of the surface of a polygon. 

Compute the centroid of the surface of a polygon projected to the XY plane. 

Compute the centroid of the vertices of a polygon. 

Compute the centroid of the edges of a polygon. 

Compute the center of mass of a polyhedron. 

Compute the midpoint of two points lying in the XYplane. 

Compute the midpoint of two points lying in the XYplane. 

Compute the midpoint of a line defined by two points. 

Compute the midpoint of a line defined by two points. 

Compute the weighted centroid of a set of points. 
Bounding Box
Computes the axisaligned minimum bounding box of a list of points. 

Compute the axisaligned minimum bounding box of a list of points in the XYplane. 

Compute the oriented minimum bounding box of a set of points in 3D space. 

Compute the oriented minimum bounding box of set of points in the XY plane. 
Bestfit
Fit a circle through a set of points. 

Fit a plane to a list of (more than three) points. 

Fit a plane through more than three (noncoplanar) points. 
Convex Hull
Construct convex hull for a set of points. 

Compute the convex hull of a set of points. 

Computes the convex hull of a set of 2D points. 

Compute the convex hull of a set of points in the XY plane. 
Distance
Calculates the closest point in a pointcloud. 

Calculates the closest point in a list of points in the XYplane. 

Computes closest point on line to a given point. 

Compute closest point on line (continuous) to a given point lying in the XYplane. 

Compute closest point on a plane to a given point. 

Find the closest point on a polyline to a given point. 

Compute closest point on a polyline to a given point, assuming they both lie in the XYplane. 

Computes closest point on line segment (p1, p2) to testpoint. 

Compute closest point on line segment to a given point lying in the XYplane. 

Compute the shortest distance between two lines. 

Compute the distance between a point and a line. 

Compute the distance between a point and a line, assuming they lie in the XYplane. 

Compute the squared distance between a point and a line. 

Compute the squared distance between a point and a line lying in the XYplane. 

Compute the distance from a point to a plane defined by three points. 

Compute the distance bewteen a and b. 

Compute the distance between points a and b, assuming they lie in the XY plane. 

Compute the squared distance bewteen points a and b. 

Compute the squared distance between points a and b lying in the XY plane. 
Interpolation
Creates a coons patch from a set of four or three boundary polylines (ab, bc, dc, ad). 

Compute the interpolated points between two sets of points. 

Compute an interpolated set of points between two sets of points, at a given distance. 
Intersections
Calculates the intersection points of two circles in 2d lying in the XY plane. 

Computes the intersection of two lines. 

Compute the intersection of two lines, assuming they lie in the XY plane. 

Computes the intersection point of a line and a plane 

Computes the intersection point of a line (ray) and a triangle based on the Moeller Trumbore intersection algorithm 

Computes the intersection of two planes 

Computes the intersection of three planes 

Compute the intersection of two lines segments, assuming they lie in the XY plane. 

Computes the intersection point of a line segment and a plane 
Isolines
Compute the contour lines of a scalarfield. 
Linalg
Add two vectors. 

Add two vectors, assuming they lie in the XYplane. 

Calculate the sum of a series of vectors along the specified axis. 

Compute the cross product of two vectors. 

Compute the cross product of two vectors, assuming they lie in the XYplane. 

Elementwise division of two vectors. 

Elementwise division of two vectors assumed to lie in the XY plane. 

Compute the dot product of two vectors. 

Compute the dot product of two vectors, assuming they lie in the XYplane. 

Calculate the length of the vector. 

Compute the length of a vector, assuming it lies in the XY plane. 

Compute the squared length of a vector. 

Compute the squared length of a vector, assuming it lies in the XY plane. 

Mutliply a matrix with a matrix. 

Multiply a matrix with a vector. 

Elementwise multiplication of two vectors. 

Elementwise multiplication of two vectors assumed to lie in the XY plane. 

Calculate the length of a vector. 

Calculate the norm of each vector in a list of vectors. 

Normalise a given vector. 

Normalize a vector, assuming it lies in the XYplane. 

Normalise multiple vectors. 

Normalise multiple vectors, assuming they lie in the XY plane. 

Orthonormalize a set of vectors. 

Raise a vector to the given power. 

Raise a list of vectors to the given power. 

Scale a vector by a given factor. 

Scale a vector by a given factor, assuming it lies in the XY plane. 

Scale multiple vectors by a given factor. 

Scale multiple vectors by a given factor, assuming they lie in the XY plane. 

Raise a vector to the power 2. 

Raise a multiple vectors to the power 2. 

Subtract one vector from another. 

Subtract one vector from another, assuming they lie in the XY plane. 

Transpose a matrix. 

Compute the component of u in the direction of v. 

Compute the component of u in the direction of v, assuming they lie in the XYplane. 
Normals
Compute the normal of a polygon defined by a sequence of points. 

Compute the normal vector of a triangle. 

Compute the normal vector of a triangle assumed to lie in the XY plane. 
Offset
Offset a line by a distance. 

Offset a polyline by a distance. 

Offset a polygon (closed) by a distance. 
Planarisation
Compute mesh flatness per face. 

Planarise a set of connected faces. 
Queries
Determine if c is on the left of ab when looking from a to b, and assuming that all points lie in the XY plane. 

Determine if three points are colinear. 

Determine if three points are colinear in the XY plane. 

Determine if the points are coplanar. 

Verifies if two lines intersection in one point. 

Determine if two lines intersect in 2d lying in the XY plane. 

Determine if a line (continuous ray) intersects with a plane. 

Verifies if a line (ray) intersects with a triangle. 

Computes the intersection of two planes 

Determine if a line segment intersects with a plane. 

Determine if two the segments ab and cd intersect? 

Determine if a polygon is convex. 

Determine if the polygon is convex in the XYplane. 

Determine if a point lies in a circle. 

Determine if a point lies in a circle lying in the XY plane. 

Determine if a point is in the interior of a convex polygon lying in the XYplane. 

Determine if a point lies on a line. 

Determine if a point lies on a line in the XYplane. 

Determine if a point lies in a plane. 

Determine if a point lies in front of a plane. 

Determine if a point is in the interior of a polygon lying in the XYplane. 

Determine if a point is on a polyline. 

Determine if a point lies on a given line segment. 

Determine if a point lies on a given line segment in the XYplane. 

Determine if a point is in the interior of a triangle. 

Determine if a point is in the interior of a triangle lying in the XYplane. 
Size
Compute the area of a polygon. 

Compute the area of a polygon lying in the XYplane. 

Compute the area of a triangle defined by three points. 

Compute the area of a triangle defined by three points lying in the XYplane. 

Compute the volume of a polyhedron represented by a closed mesh. 
Smoothing
Smooth a connected set of vertices by moving each vertex to the centroid of its neighbors. 

Smooth a connected set of vertices by moving each vertex to the center of mass of the polygon formed by the neighboring vertices. 

Smooth a set of connected vertices by moving each vertex to the centroid of the surrounding faces, weighted by the area of the face. 
Transformations
Mirror a point about a line. 

Mirror a point about a line. 

Mirror a point about a plane. 

Mirror multiple points about a point. 

Mirror multiple points about a point. 

Project points onto a line. 

Project points onto a line in the XY plane. 

Project multiple points onto a plane. 

Bounce a line of a reflection plane. 

Bounce a line of a reflection triangle. 

Rotates points around an arbitrary axis in 3D. 

Rotates points in the XY plane around the Z axis at a specific origin. 

Scale points. 

Translate points. 

Translate points and in the XY plane. 
Triangulation
Computes the delaunay triangulation for a list of points. 

Computes the delaunay triangulation for a list of points using Numpy. 

Construct a Delaunay triangulation of set of vertices. 

Construct a Delaunay triangulation of set of vertices, constrained to the specified segments. 

Construct a Delaunay triangulation of set of vertices, constrained to the specified segments, and with as many Steiner points inserted as necessary to make sure all faces of the triangulation are Delaunay. 

Generate a voronoi diagram from a set of points. 