geometry
Primitives
Base Classes
Base class for geometric primitives. 
Classes
A circle is defined by a plane and a radius. 

A ellipse is defined by a plane and a major. 

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

A line is defined by two points. 

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

A point is defined by XYZ coordinates. 

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

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

Creates a 

A vector is defined by XYZ components and a homogenisation factor. 
The following representations of primitives can be used interchangeably as input in methods and functions. The representations using native Python objects also correspond to the required input parameters of the default constructor functions of the corresponding COMPAS objects.
Object 
COMPAS 
Python 
point 
Point(float, float, float) 
[float, float, float] 
vector 
Vector(float, float, float) 
[float, float, float] 
line 
Line(point, point) 
[[float, float, float], [float, float, float]] 
plane 
Plane(point, vector) 
[[float, float, float], [float, float, float]] 
circle 
Circle(plane, float) 
[[[float, float, float], [float, float, float]], float] 
polygon 
Polygon(points) 
[[float, float, float], … [float, float, float]] 
polyline 
Polyline(points) 
[[float, float, float], … [float, float, float]] 
ellipse 
Ellipse(plane, float, float) 
[[[float, float, float], [float, float, float]], float, float] 
frame 
Frame(point, vector, vector) 
[[float, float, float], [float, float, float], [float, float, float]] 
COMPAS primitives also support indexing, assignment, and iteration according to the above equivalency.
>>> a = Point(0, 0, 0)
>>> x, y, z = a
>>> x = a[0]
>>> a[0] = 0
>>> plane = Plane(Point(0, 0, 0), Vector(0, 0, 1))
>>> a, n = plane
>>> x, y, z = n
>>> plane[0] = Point(1, 0, 0)
Shapes
Base Classes
Base class for geometric shapes. 
Classes
A box is defined by a frame and its dimensions along the frame’s x, y and zaxes. 

A capsule is defined by a line segment and a radius. 

A cone is defined by a circle and a height. 

A cylinder is defined by a circle and a height. 

A polyhedron is defined by its vertices and faces. 

A sphere is defined by a point and a radius. 

A torus is defined by a plane and two radii. 
Predicates 2D
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 on the XYplane. 

Determine if the polygon is convex on the XYplane. 

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

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

Determine if a point is on a polyline on the XYplane. 

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

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

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

Determine if a point lies in a circle lying on the XYplane. 

Determine if a polygon is in the interior of another polygon on the XYplane. 
Predicates 3D
Determine if three points are colinear. 

Determine if the points are coplanar. 



Determine if the point lies inside the given polyhedron. 



Determine if a point lies on a line. 

Determine if a point lies on a plane. 

Determine if a point is on a polyline. 

Determine if a point lies on a given line segment. 

Determine if a polygon is convex. 
Transformations
Classes
Create a projection transformation. 

Creates a 

Create a rotation transformation. 

Creates a scale transformation. 

Create a shear transformation. 

The 

Create a translation transformation. 
Functions
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. 
Conversions
Returns the axis and the angle of the rotation matrix M. 

Returns the axisangle vector of the rotation matrix M. 

Returns an axis and an angle of rotation from the given quaternion. 

Returns the basis vectors from the rotation matrix R. 

Returns Euler angles from the rotation matrix M according to specified axis sequence and type of rotation. 

Returns Euler angles from a quaternion. 

Computes a change of basis transformation from world XY to the frame. 

Calculates a rotation matrix from Euler angles. 

Calculates a rotation matrix from an rotation axis, an angle and an optional point of rotation. 

Calculates a rotation matrix from an axisangle vector. 

Creates a rotation matrix from basis vectors (= orthonormal vectors). 

Returns a 4x4 translation matrix in rowmajor order. 

Returns an orthogonal projection matrix to project onto a plane. 

Returns an parallel projection matrix to project onto a plane. 

Returns a perspective projection matrix to project onto a plane along lines that emanate from a single point, called the center of projection. 

Returns a matrix from perspective entries. 

Returns a shear matrix from the 3 factors for xy, xz, and yz axes. 

Constructs a shear matrix by an angle along the direction vector on the shear plane (defined by point and normal). 

Returns a 4x4 scaling transformation. 

Calculates a rotation matrix from quaternion coefficients. 

Returns the 4 quaternion coefficients from a rotation matrix. 

Returns a quaternion from Euler angles. 

Returns a quaternion describing a rotation around the given axis by the given angle. 
Quaternion math
Calculates the length (euclidean norm) of a quaternion. 

Makes a quaternion unitlength. 

Checks if a quaternion is unitlength. 

Multiplies two quaternions. 

Converts a quaternion into a canonic form if needed. 

Conjugate of a quaternion. 
Linear algebra
Add two vectors. 

Add two vectors, assuming they lie in the XYplane. 

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. 

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

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. 

Average of a vector. 

Variance of a vector. 

Standard deviation of a vector. 
Points, Vectors, Lines, Planes
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. 

Computes the signed angle between 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. 

Compute the smallest angle between the two normal vectors of two planes. 

Compute the centroid of a set of points. 

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

Compute the weighted centroid of a set of points. 

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 origin point and normal. 

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. 

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. 
Polygons & Polyhedrons
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 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 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. 

Compute the volume of a polyhedron represented by a closed mesh. 
Point Sets
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. 

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. 

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. 
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 test point. 

Compute closest point on a line segment to a given point lying in the XYplane. 
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 on 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 

Compute the intersection of tow meshes. 

Computes the intersection of two planes 

Computes the intersection of three planes 

Compute the intersection(s) between a ray and a mesh. 

Compute the intersection of two lines segments. 

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 

Verifies if two lines intersect. 

Verifies if two lines intersect on the XYplane. 

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

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

Verifies if two planes intersect. 

Determine if a line segment intersects with a plane. 

Verifies if two segments intersect. 

Determines if two segments, ab and cd, intersect. 
Offsets
Offset a line by a distance. 

Offset a polyline by a distance. 

Offset a polygon (closed) by a distance. 
Interpolation
Compute the barycentric coordinates of a point wrt to a triangle. 

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. 
Fitting
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. 
Boolean operations
Compute the boolean union of two triangle meshes. 

Compute the boolean difference of two triangle meshes. 

Compute the boolean intersection of two triangle meshes. 
Triangulation
Construct a Conforming Delaunay triangulation of set of vertices, constrained to the specified segments. 

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

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. 

Generate a voronoi diagram from a set of points. 
Triangle meshes
Compute the discrete gaussian curvature of a triangle mesh. 

Compute the geodesic distance from every vertex of the mesh to a source vertex. 

Compute the harmonic parametrisation of a triangle mesh within a fixed circular boundary. 

Compute isolines on a triangle mesh using a scalarfield of data points assigned to its vertices. 

Compute the least squares conformal map of a triangle mesh. 

Compute massmatrix on a triangle mesh using a scalarfield of data points assigned to its vertices. 

Compute the principal curvature directions of a triangle mesh. 

Remeshing of a triangle mesh. 

Constrained remeshing of a triangle mesh. 

Slice a mesh by a list of planes. 
Quad meshes
Planarize the faces of a quad mesh. 
Pointclouds
Align two point clouds using the Iterative Closest Point (ICP) method. 