polygon_sample, a MATLAB code which uniformly samples points in a polygon.
The polygon is defined by a list of the coordinates of the vertices of the polygon, in counterclockwise order.
This function cannot triangulate a polygon which includes one or more "holes". That is actually a significantly more difficult task.
The output of the function is a list of the N-3 triples of nodes that form the triangles of the triangulation.
The information on this web page is distributed under the MIT license.
polygon_sample 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.
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, sampling, triangulation.
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.
random_data, a MATLAB code which uses a random number generator (RNG) to sample points corresponding to various probability density functions (PDF), spatial dimensions, and geometries, including the annulus, circle, ellipse, ellipsoid, hypercube, hypersphere, simplex, tetrahedron and triangle.
John Burkardt.