triangle_histogram, a FORTRAN90 code which creates a histogram of data over the interior of the unit triangle in 2D.
The unit triangle has the vertices (1,0), (0,1), (0,0).
"Data" in the unit triangle is assumed to take the form of a file, containing a list of points that lie in the triangle.
The sides of the triangle can each be divided into N subintervals, and by connecting them, the result is N*N subtriangles of the same area.
The program then determines the number of points that lie within each subtriangle, and prints this list.
This program is particularly suitable for investigating whether a set of points in the unit triangle are close to a uniformly sampling, or if there is some bias in the selection.
triangle_histogram data_file nwhere
The computer code and data files described and made available on this web page are distributed under the MIT license
triangle_histogram is available in a C++ version and a FORTRAN90 version and a MATLAB version.
RANDOM_DATA, a FORTRAN90 code which produces random samples from a number of regions, including triangles.