triangle_histogram


triangle_histogram, a C++ code which creates a histogram of data in the unit triangle.

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.

Usage:

triangle_histogram data_file n
where

Licensing:

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

Languages:

triangle_histogram is available in a C++ version and a FORTRAN90 version and a MATLAB version.

Related Data and Programs:

RANDOM_DATA, a C++ code which produces random samples from a number of regions, including triangles.

TRIANGLE_ANALYZE, a C++ code which reads a triangle defined in a file, and uses the triangle_properties() library to compute angles, area, centroid, circumcircle, edge lengths, incircle, orientation, orthocenter, and quality.

triangle_histogram_test

TRIANGLE_MONTE_CARLO, a C++ code which uses the Monte Carlo method to estimate integrals over a triangle.

TRIANGLE_SAMPLES, a dataset directory which contains sets of sample points drawn from the unit triangle.

Reference:

  1. Reuven Rubinstein,
    Monte Carlo Optimization, Simulation and Sensitivity of Queueing Networks,
    Krieger, 1992,
    ISBN: 0894647644,
    LC: QA298.R79.
  2. Greg Turk,
    Generating Random Points in a Triangle,
    in Graphics Gems I,
    edited by Andrew Glassner,
    AP Professional, 1990,
    ISBN: 0122861663,
    LC: T385.G697

Source Code:


Last revised on 03 May 2020.