geometry


geometry, a MATLAB code which carries out geometric calculations in 2, 3 and N space.

These calculations include angles, areas, containment, distances, intersections, lengths, and volumes.

Some geometric objects can be described in a variety of ways. For instance, a line has implicit, explicit and parametric representations. The names of routines often will specify the representation used, and there are routines to convert from one representation to another.

Another useful task is the delineation of a standard geometric object. For instance, there is a routine that will return the location of the vertices of an octahedron, and others to produce a series of "equally spaced" points on a circle, ellipse, sphere, or within the interior of a triangle.

Note that I much prefer vectors to be expressed as column vectors; MATLAB, on the other hand, seems to make it easier to work with row vectors. In my original codes, I primarily used row vectors, but I have determined to convert to column vectors; the code is in the middle of this transition, so in some cases there may be be some inconsistencies in style, and accidental inconsistencies in use. On the other hand, I am willing to put up with the practice of declaring a column vector's entries as though they were in a matrix of dimension n by 1, since this guarantees me that, for instance, a dot product is written as (u' * v), and everything finally makes sense to me.

Licensing:

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

Languages:

geometry is available in a C version and a C++ version and a FORTRAN90 version and a MATLAB version and a Python version.

Related Programs:

geometry_test

delaunay_test, a MATLAB code which calls the MATLAB built-in function delaunay(), which computes the Delaunay triangulation of a set of points.

ellipse, a MATLAB code which carries out geometric calculations for ellipses and ellipsoids, including area, distance to a point, eccentricity, perimeter, points along the perimeter, random sampling, conversion between standard and quadratic forms.

hypersphere, a MATLAB code which carries out various operations for an M-dimensional hypersphere, including converting between Cartesian and spherical coordinates, stereographic projection, sampling the surface of the sphere, and computing the surface area and volume.

polygon, a MATLAB code which carries out geometric calculations on polygons, including angles, area, centroid, containment of a point, diameter, integrals of monomials, convexity, distance to a point.

quadrilateral, a MATLAB code which carries out geometric calculations on quadrilaterals, including angles, area, distances, nearest point, point containment, perimeter, and random generation.

simplex_coordinates, a MATLAB code which computes the Cartesian coordinates of the vertices of a regular simplex in M dimensions.

sphere_grid, a MATLAB code which provides a number of ways of generating grids of points, or of points and lines, or of points and lines and faces, over the unit sphere.

sphere_stereograph, a MATLAB code which computes the stereographic mapping between points on the unit sphere and points on the plane Z = 1.

tetrahedron, a MATLAB code which carries out geometric calculations involving a general tetrahedron, including solid and facial angles, face areas, point containment, distances to a point, circumsphere and insphere, measures of shape quality, centroid, barycentric coordinates, edges and edge lengths, random sampling, and volumes.

tetrahedrons, a dataset directory which contains examples of tetrahedrons;

triangles, a dataset directory which contains examples of triangles;

triangulate, a MATLAB code which triangulates a (possibly nonconvex) polygon.

triangulation, a MATLAB code which defines and analyzes triangulations.

Source code:


Last revised on 27 April 2022.