private static Point? DirectionalProject(Point p, Vector v, Point[] polyline)
        {
            foreach (var pair in polyline.SeqPairs())
            {
                var segStart = pair.Item1;
                var segEnd = pair.Item2;
                Point result;
                if (LineIntersectSegment(p, v, segStart, segEnd, out result))
                    return result;
            }

            return null;
        }