compas.geometry
This package defines all functionality for working with geometry in COMPAS. It provides classes representing geometric primitives, transformations, (NURBS) curves and surfaces, shapes, general polygons and polyhedrons, boundary representations (Breps), and a number of geometry processing algorithms.
Classes
An arc is a segment of a circle, and is defined by a coordinate system, radius, and start and end angles. 

A Bezier curve is defined by control points and a degree. 

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

Contains the topological and geometrical information of a Brep shape. 

An interface for a Brep Edge 

Represents a generic error in the Brep context 

An interface for a Brep Face. 

Raised when a fillet operation has failed or had not result 

Raised when the process of reconstructing a Brep has resulted in an invalid Brep 

An interface for a Brep Loop. 

Possible orientations of a Brep 

An interface for a Brep Trim 

An enumeration of isoparametric curve direction on the surface. 

Raised when a trimming operation has failed or had not result 

Possible types of a Brep 

An interface for a Brep Vertex 

A capsule is defined by a frame, radius, and height. 

A circle is a curve defined by a coordinate system and a radius. 

A cone is defined by a frame, radius, and height. 

A cylindrical surface is defined by a radius and a local coordinate system. 

Class representing a general parametric curve. 

Enumaration of curve types. 

A cylinder is defined by a frame, radius, and height. 

A cylindrical surface is defined by a radius and a local coordinate system. 

An ellipse is a curve defined by a coordinate system and a major and minor axis. 

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

Base class for all geometric objects. 

A hyperbola is defined by a coordinate frame and a major and minor axis. 

A tree for nearest neighbor search in a kdimensional space. 

A line is a curve defined by two points. 

A NURBS curve is defined by control points, weights, knots, and a degree. 

A NURBS surface is defined by control points, weights, knots, and a degree, in two directions U and V. 

A parabola is defined by a plane and a major and minor axis. 

A planar surface is defined by a local coordinate system and a size. 

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

A point is defined by XYZ coordinates. 

Class for working with pointclouds. 

A polygon is a geometric object defined by a sequence of points forming a closed loop. 

A polyhedron is a geometric object defined by its vertices and faces. 

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

Class representing a projection transformation. 

A quaternion is defined by 4 components, X, Y, Z, and W. 

Class representing a reflection transformation. 

Class representing a rotation transformation. 

Class representing a scale transformation. 

Base class for geometric shapes. 

Class representing a shear transformation. 

A sphere is defined by a point and a radius. 

A spherical surface is defined by a radius and a frame. 

Class representing a general surface object. 

Enumaration of surface types. 

A spherical surface is defined by a radius and a frame. 

A torus is defined by a plane and two radii. 

Class representing a general 4x4 transformation matrix. 

Class representing a translation transformation. 

A vector is defined by XYZ components and a homogenisation factor. 
Functions
Add two vectors. 

Add two vectors, assuming they lie in the XYplane. 

Compute the smallest angle between the two normal vectors of two 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. 

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

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. 

Returns the index of the first maximum value within an array. 

Returns the index of the first minimum value within an array. 

Returns the axis and the angle of the rotation matrix M. 

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

Returns the axisangle vector of the rotation matrix M. 

Compute the barycentric coordinates of a point wrt to a triangle. 

Returns the basis vectors from the rotation matrix R. 

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

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 centroid of a set of points. 

Compute the weighted 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 edges of a polygon. 

Compute the centroid of the edges of a polygon prohected to the XY plane. 

Compute the centroid of the vertices of a polygon. 

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

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

Compute the center of mass of a polyhedron. 

Compute closest line to a point from a list of lines. 

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. 

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

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. 

Calculates a matrix from the components of scale, shear, euler_angles, translation and perspective. 

Compute the nonzero basis functions for a given parameter value. 

Compute the derivatives of the basis functions for a given parameter value. 

Construct a nonperiodic (clamped), uniform knot vector for a curve with given degree and number of control points. 

Construct convex hull for a set of points. 

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

Compute the cross product of two vectors. 

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

Calculates the components of rotation, translation, scale, shear, and perspective of a given transformation matrix M. 

Dehomogenise a list of vectors. 

Creates a coons patch from a set of four or three boundary polylines (ab, bc, dc, ad). 

Compute the shortest distance between two lines. 

Compute the distance between a point and a line. 

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 between a point and a line, assuming they lie in the XYplane. 

Compute the distance from a point to a plane defined by origin point and normal. 

Compute the signed distance from a point to a plane defined by origin point and normal. 

Compute the distance bewteen a and b. 

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 distance between points a and b, assuming they lie in the XY plane. 

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. 

Triangulate a polygon using the ear clipping method. 

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

Returns Euler angles from a quaternion. 

Find the knot span index for a given knot value. 

Homogenise a list of vectors. 

Construct an identity matrix. 

Calculates the intersection points of two circles in 2d lying in the XY plane. 

Computes the intersection of an ellipse and a line in the XY plane. 

Compute the intersection between a line and a box 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 

Compute the intersection of a line and a segment. 

Compute the intersection between a line and a segment. 

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

Computes the intersection of a plane and a circle. 

Computes the intersection of two planes 

Computes the intersection of three planes 

Compute the intersection between a polyline and a box in the XY plane. 

Calculate the intersection point of a plane with a polyline. 

Computes the intersection point of a line segment and a plane 

Calculate the intersection point of a segment and a polyline. 

Calculate the intersection point of a segment and a polyline on the XYplane. 

Compute the intersection of two lines segments. 

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

Computes the intersection of a sphere and a line. 

Computes the intersection of 2 spheres. 

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 two lines are colinear. 

Determine if three points are colinear on the XYplane. 

Determine if the points are coplanar. 

Verify that a matrix is square. 

Determine if two lines are parallel. 

Determine if two vectors are parallel. 

Determine if a point lies behind a plane. 

Determine if a point lies in a circle. 

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

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

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

Determine if the point lies inside the given polyhedron. 

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

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

Determine if a point lies in front of a plane. 

Determine if a point lies on a line. 

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

Determine if a point lies on a plane. 

Determine if a point is on a polyline. 

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

Determine if a point lies on a given line segment. 

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

Determine if a polygon is convex. 

Determine if the polygon is convex on the XYplane. 

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

Convert a list of knots and multiplicities to a knot vector. 

Convert a knot vector to a list of knots and multiplicities. 

Calculate the length of the vector. 

Compute the squared length of a vector. 

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

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

Convert local coordinates to global coordinates. 

Calculates the determinant of a square matrix M. 

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). 

Computes a change of basis transformation between two frames. 

Calculates a rotation matrix from Euler angles. 

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

Computes a transformation between two frames. 

Returns an orthogonal projection matrix to project onto a plane. 

Returns an parallel projection matrix to project onto a plane. 

Returns a matrix from perspective entries. 

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

Calculates a rotation matrix from quaternion coefficients. 

Returns a 4x4 scaling transformation. 

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

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

Returns a 4x4 translation matrix in rowmajor order. 

Calculates the inverse of a square matrix M. 

Construct the minor corresponding to an element of a matrix. 

Compute the midpoint of a line defined by two points. 

Compute the midpoint of a line defined by two points. 

Compute the midpoint of two points. 

Compute the midpoint of two points lying in the XYplane. 

Mirror a point about a plane. 

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. 

Mirrors vector about vector. 

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. 

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. 

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. 

Offset a line by a distance. 

Offset a polygon (closed) by a distance. 

Offset a polyline by a distance. 

Orient points from one plane to another. 

Corrects xaxis and yaxis to be unit vectors and orthonormal. 

Orthonormalize a set of vectors. 

Raise a vector to the given power. 

Raise a list of vectors to the given power. 

Project a point onto a line. 

Project a point onto a line in the XY plane. 

Project a point onto a plane. 

Project points onto a line. 

Project points onto a line in the XY plane. 

Project multiple points onto a plane. 

Converts a quaternion into a canonic form if needed. 

Conjugate of a quaternion. 

Returns a quaternion describing a rotation around the given axis by the given angle. 

Returns a quaternion from Euler angles. 

Returns the 4 quaternion coefficients from a rotation matrix. 

Checks if a quaternion is unitlength. 

Multiplies two quaternions. 

Calculates the length (euclidean norm) of a quaternion. 

Makes a quaternion unitlength. 

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. 

Scale points in the XY plane. 

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. 

Sorts points of a pointcloud based on their distance from a given point. 

Sorts points of a pointcloud based on their distance from a given point, assuming all points 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. 

Calculates the tangent points on a circle in the XY plane. 

Transform multiple frames with one transformation matrix. 

Transform multiple points with one transformation matrix. 

Transform multiple vectors with one transformation matrix. 

Translate points. 

Translate points and in the XY plane. 

Returns the 3 values of translation from the matrix M. 

Transpose a matrix. 

Compute the interpolated points between two sets of points. 

Compute an interpolated set of points between two sets of points, at a given distance. 

Average of a vector. 

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. 

Standard deviation of a vector. 

Variance of a vector. 

Compute the volume of a polyhedron represented by a closed mesh. 

Convert global coordinates to local coordinates. 
Functions using Numpy
In environments where numpy is not available, these functions can still be accessed through RPC.
Fit a circle through a set of points. 

Fit a frame to a set of points. 

Fit a line through a set of points. 

Fit a plane through more than three (noncoplanar) points. 

Returns the sphere's center and radius that fits best through a set of points. 

Find the closest points in a point cloud to a set of sample points. 

Compute the convex hull of a set of points. 

Compute the convex hull of a set of points in the XY plane. 

Dehomogenize a list of vectors and unflatten the 2D list into a 3D list. 

Dehomogenizes points or vectors. 

Homogenize a list of frames and flatten the 3D list into a 2D list using numpy. 

Dehomogenizes points or vectors. 

Align two point clouds using the Iterative Closest Point (ICP) method. 

Convert local coordinates to global (world) coordinates. 

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. 

Compute the principle components of a set of data points. 

Transform multiple points with one Transformation using numpy. 

Transform multiple vectors with one Transformation using numpy. 

Compute the descent directions of a triangular mesh as the gradient of the vertex heights. 

Construct the gradient operator of a trianglular mesh. 

Convert global coordinates to local coordinates. 
Pluggables
Pluggables are functions that don’t have an actual implementation, but receive an implementation from a plugin.
Compute the boolean difference of two triangle meshes. 

Compute the boolean difference of two polygons. 

Compute the boolean intersection of two triangle meshes. 

Compute the boolean intersection of two polygons. 

Compute the boolean symmetric difference of two polygons. 

Compute the boolean union of two triangle meshes. 

Compute the boolean union of two polygons. 

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. 

Construct a Delaunay triangulation of set of vertices. 

Compute the intersection of two meshes. 

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

Computes the oriented minimum bounding box of a list of points. 

Planarize the faces of a quad mesh. 

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 discrete mean curvature of a triangle mesh. 

Compute the principal curvature directions of a triangle mesh. 

Remeshing of a triangle mesh. 

Remesh a mesh along an isoline of a scalarfield over the vertices. 

Constrained remeshing of a triangle mesh. 

Slice a mesh by a list of planes. 