Samples from the Unit Triangle

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

The unit triangle has vertices (1,0), (0,1), (0,0).

Given a function rand() which returns values in the interval [0,1], it is easy to construct methods of sampling the unit square, cube, and the general hypercube. It is not quite so easy to deal with the triangle, tetrahedron, and general simplex.

For the triangle, things are not so serious. The simplest method involves rejection, generating points in the unit square and discarding those that are outside the triangle. Another simple method simply "folds" points that lie above the line x+y=1, which means no generated points are rejected. Other methods work with the barycentric coordinates that can be applied as well to the general triangle.

This directory collects sets of sample points of various sizes, so that it is easy to find data that one can check for uniformity.


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

Related Data and Programs:

RANDOM_DATA, a C++ library which provides sample points from various regions, including triangles.

TETRAHEDRON_SAMPLES, a dataset directory which contains examples of sets of sample points from the unit tetrahedron.

TRIANGLE_HISTOGRAM, a C++ library which creates a kind of histogram of data on the unit triangle, which makes it easy to check for uniformity of sampling.

Data Files:

B100 and its relatives are samplings based on a "bad" scheme. Points tend to cluster near the centroid.

G100 and its relatives are samplings based on a "good" scheme. Points are well distributed.

UNIFORM_IN_TRIANGLE01_MAP is a dataset created by the RANDOM_DATA program. Points are well distributed.

You can go up one level to the DATASETS page.

Last revised on 13 August 2009.