Tag Archives: lines intersect

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 , , , , , , , , , , , , , , | 26 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

Determine where two lines intersect in C#

This example determines whether two segments intersect and where the lines that contain them intersect. There are several ways you can approach this problem. This example uses lines defined by parametric equations where 0 <= t1, t2 <= 1. If … Continue reading

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