squaredSegmentDistance(point, lineStart, lineEnd): number
The function calculates the squared distance from a point to a line segment.
Using squared distances avoids costly square root operations and doesn't
affect the result because we're only interested in relative distances.
Parameters
point: [number, number]
The point from which distance is to be measured
lineStart: [number, number]
The start point of the line segment
lineEnd: [number, number]
The end point of the line segment
Returns number
The squared distance from the point to the line segment
The function calculates the squared distance from a point to a line segment. Using squared distances avoids costly square root operations and doesn't affect the result because we're only interested in relative distances.