public IntersectionInfo GetIntersectionWith (Stroke other)
{
for (var i = 0; i < _points.Count - 1; i++) {
var x1 = _points [i].X;
var y1 = _points [i].Y;
var x21 = _points [i + 1].X - x1;
var y21 = _points [i + 1].Y - y1;
for (var j = 0; j < other._points.Count - 1; j++) {
var x3 = other._points [j].X;
var y3 = other._points [j].Y;
var x43 = other._points [j + 1].X - x3;
var y43 = other._points [j + 1].Y - y3;
var x13 = x1 - x3;
var y13 = y1 - y3;
var d = y43*x21 - x43*y21;
if (d == 0.0f) continue;
var na = x43*y13 - y43*x13;
var ua = na / d;
if (ua < 0 || ua > 1) continue;
var nb = x21*y13 - y21*x13;
var ub = nb / d;
if (ub >= 0 && ub <= 1) {
var loc = new PointF (x1 + ua * x21, y1 + ua * y21);
return new IntersectionInfo (loc);
}
}
}
return null;
}