I need to find the distance from a point to a line.
using the math I found at http://local.wasp.uwa.edu.au/~pbourke/geometry/pointline/
I came up with
distance = ( (Point.X - LineStart.X)*(LineEnd.X - LineStart.X) + (Point,Y - LineStart.Y)*(LineEnd.Y - LineStart.Y) ) / Sqr( (LineEnd.X-LineStart.X)*(LineEnd.X-LineStart.X) - (LineEnd.Y-LineStart.Y)*(LineEnd.Y-LineStart.Y) )
But all it gets me is the distance from the linestart. The math is making my head spin, does anyone have a function or non-broken equation for this?
|