Tag Archives: lines segments

Find the shortest distance between a point and a line segment in C#

This example treats the segment as parameterized vector where the parameter t varies from 0 to 1. It finds the value of t that minimizes the distance from the point to the line. If t is between 0.0 and 1.0, … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , | 33 Comments

Find the shortest distance between two line segments in C#

Click four points to pick the end points for the two line segments. The program finds the points on the two segments that are closest and connects them. The closest distance between two segments is either 0 if they intersect, … Continue reading

Posted in algorithms, geometry, graphics, mathematics | Tagged , , , , , , , , , , , , , , | 1 Comment