# triangle_distance

triangle_distance, a Python code which computes the expected value of the distance between a pair of points randomly selected in a triangle.

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.

### Languages:

triangle_distance is available in a MATLAB version and a Python version.

### Related Data and Programs:

ball_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit ball in 3D.

circle_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected on the circumference of the unit circle in 2D.

cube_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit cube.

disk_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit disk in 2D.

hyperball_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit hyperball in M dimensions.

hypersphere_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected on the unit hypersphere in M dimensions.

line_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit line segment.

normal01_multivariate_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected from an isotropic standard normal distribution in M dimensions.

sphere_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected on the unit sphere in 3D.

square_distance, a Python code which considers the problem of describing the typical value of the distance between a pair of points randomly selected in the unit square in 2D.

### 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:

Last revised on 23 May 2019.