polygon


polygon, a MATLAB code which computes properties of an arbitrary polygon in the plane, defined by a sequence of vertices, including interior angles, area, centroid, containment of a point, convexity, counter clockwise ordering, diameter, distance to a point, inradius, lattice area, nearest point in set, outradius, uniform sampling, and triangulation.

Licensing:

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

Languages:

polygon is available in a C version and a C++ version and a Fortran90 version and a MATLAB version and an Octave version and a Python version.

Related Programs:

polygon_test

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.

polygon_average, a MATLAB code which demonstrates a process of repeatedly averaging and normalizing the vertices of a polygon, illustrating a property of the power method.

polygon_distance, a MATLAB code which computes the expected value of the distance between a pair of points randomly selected from a polygon in 2D.

polygon_grid, a MATLAB code which generates a grid of points over the interior of a polygon in 2D.

polygon_integrals, a MATLAB code which returns the exact value of the integral of any monomial over the interior of a polygon in 2D.

polygon_monte_carlo, a MATLAB code which applies a monte carlo method to estimate the integral of a function over the interior of a polygon in 2d.

polygon_triangulate, a MATLAB code which triangulates a (possibly nonconvex) polygon, based on a C function by Joseph Orourke.

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

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.

Source code:


Last revised on 27 April 2022.