public static Vector GetIntersection(Vector _start1, Vector _end1, Vector _start2, Vector _end2) { double a1 = Meth.Tan((_end1 - _start1).Angle); double a2 = Meth.Tan((_end2 - _start2).Angle); if (a1 != a2) { double x = (a1 * _start1.X - a2 * _start2.X - _start1.Y + _start2.Y) / (a1 - a2); Vector v = new Vector(x, _start1.Y + (x - _start1.X) * a1); if ((v - _start1).Length <= (_end1 - _start1).Length) { return(v); } } return((_start1 + _start2 + _end1 + _end2) / 4); }