Home

Awesome

GeometRi

Simple and lightweight computational geometry library for .Net

Main purpose of the GeometRi library is manipulations with basic geometrical primitives, such as point, line, plane, sphere, triangle in 3D space: translation and rotation operations, distance calculation, intersections, orthogonal projections of one object into another, etc. The objects can be defined in global or in one of the local coordinate systems and converted form one coordinate system into another.

The library was build to be as simple and intuitive as posible. Users do not have to remember the reference coordinate system of each object. The objects store the coordinate system they are defined in and all transformations will be caried out implicitly when necessary.

The main goal was simplisity and readability of the code, therefore speed and robustness was not a priority. Global tolerance property is used for proximity checking, not an exact robust algorithms.

Release notes

Installation

Use NuGet to install library. Search for GeometRi in NuGet package manager or type in the Package Manager Console:

Install-Package GeometRi

Examples

Classes

Point3d

One of the base classes, can be constructed by three double numbers (X, Y and Z) or from double array. Each constructor has optional parameter 'coord' for local coordinate system in which point will be defined. By default all points are defined in global coordinate system.

Properties

Methods

Static methods

Overloaded operators

Vector3d

Second base class, representing vector in 3D space. Constructed by three components (X, Y and Z) or from double array (with optional 'coord' parameter for local cordinate system). Additionally, can be constructed by point, representing radius vector of that point, or by two points, representing vector from first point to another. In this cases the vector will be defined in the same coordinate system as the first operand.

Properties

Methods

Line3d

Infinite line in 3D space and defined by any point lying on the line and a direction vector.

Properties

Methods

Ray3d

Represent ray in 3D space and is defined by starting point and direction vector.

Properties

Methods

Segment3d

Represent a line segment in 3D space and is defined by two points.

Properties

Methods

Plane3d

3D plane defined by arbutrary point on the plane and a normal vector. Optionally can be defined by coefficients in general equation of plane (Ax + By + Cz + D = 0), by three points or by point and two vectors in the plane.

Properties

Methods

Sphere

Defines a sphere in 3D space. Implements intersection with line, plane and other sphere, projection to line and plane, as well as common translation, rotation and reflection methods.

Properties

Methods

Circle3d

Defines a circle in 3D space by center point, radius and normal vector.

Properties

Methods

Ellipse

Ellipse in 3D space, defined by center point and two orthogonal vectors, major and minor semiaxes.

Properties

Methods

Ellipsoid

Ellipsoid object defined by center point and three mutually orthogonal vectors.

Properties

Methods

Box3d

Box object defined by center point, three dimensions and orientation in space.

Properties

Methods

Static Methods

AABB

Axis aligned 3D box, can be degenerated with one or more dimensions equal 0. Defined only in Global CS.

Properties

Methods

Triangle

Defines a triangle in 3D space. Implements common translation, rotation and reflection methods. Calculates most of the standard triangle properties: bisectors, meadians, altitudes, incenter, circumcenter, centroid, orthocenter, etc.

Properties

Methods

Tetrahedron

Defines a tetrahedron in 3D space. Implements common translation, rotation and reflection methods.

Properties

Methods

ConvexPolyhedron

Defines a convex polyhedron in 3D space with counterclockwise oriented faces (seen from outside).

Properties

Methods

Static Methods

Coord3d

Class representing orthogonal cartesian 3D coordinate system. Defined by an origin point and transformation matrix (three orthogonal unit vectors stored in row format). One global coordinate system (Coord3d.GlobalCS) is defined by default, any number of local coordinate systems can be defined by users.

Properties

Methods

Matrix3d

Properties

Methods

Static methods

Quaternion

Unit quaternion (W + Xi + Yj + Z*k)

Properties

Methods

Static methods

Rotation

Rotation in 3D space defined in global or local reference frame (internally represented by rotation matrix)

Properties

Methods

Static methods

GeometRi3D

Properties

Methods