triangle_distance
triangle_distance,
an Octave code which
estimates the expected value of the distance
between a pair of points randomly selected in a triangle in 2D.
This problem is notably more complicated than when the sampling region
is a square. In particular, the probability density function for the
distance seems to be known only for special cases, such as a right
triangle or equilateral triangle.
Licensing:
The information on this web page is distributed under the MIT license.
Languages:
triangle_distance is available in
a MATLAB version and
an Octave version and
a Python version.
Related Data and Programs:
triangle_distance_test
octave_distance,
an Octave code which
estimates the typical distance between a pair of points
randomly selected from the surface or interior of a
geometric object such as a circle, disk, sphere, cube.
Reference:
-
Uwe Baesel,
Random chords and point distances in regular polygons,
Acta Mathematica Universitatis Comenianae,
Volume LXXXII, Number 1, pages 1-18, 2014.
-
Uwe Baesel,
The distribution function of the distance between two random points
in a right-angled triangle,
arXiv:1208.6228v2 17 September 2012.
Source Code:
-
histogram_pdf.m,
creates a PDF-normalized histogram of data.
-
triangle_distance_histogram.m,
displays a histogram from N samples of pairwise distances.
-
triangle_distance_stats.m,
estimates the mean and variance of the pairwise distance, using sampling.
-
triangle_equilateral_distance_pdf.m,
displays a plot of the exact PDF of the pairwise distances
in an equilateral triangle.
-
triangle_print.m,
prints a triangle.
-
triangle_right_distance_pdf.m,
displays a plot of the exact PDF of the pairwise distances
in an equilateral triangle.
-
triangle_right_error.m,
determines how close a triangle is to a right triangle.
-
triangle_sample.m,
returns a random point in a triangle.
-
triangle_sides.m,
computes the lengths of the sides of a triangle and returns
them in increasing order.
-
histogram_pdf.m,
creates a histogram plot of data, normalized to estimate the PDF;
Last revised on 14 December 2022.