Keywords: Math, point to line, perpendicular distance

Describtion:
Known location of points A, B and C, calculate the shortest distance (perpendicular distance) of point A and line BC.

Source:

double computeDistance(vec3 A, vec3 B, vec3 C) 
{
    vec3 d = (C - B) / C.distance(B);
    vec3 v = A - B;
    double t = v.dot(d);
    vec3 P = B + t * d;
    return P.distance(A);
}

Origin:
https://math.stackexchange.com/a/1905794/601445


He was still too young to know that the heart's memory eliminates the bad and magnifies the good, and that thanks to this artifice we manage to endure the burden of the past. ― Gabriel García Márquez, Love in the Time of Cholera