Ejemplo n.º 1
0
        public string[] ProcessTask(string[] stdIn)
        {
            var c1   = Parse.ParseCount(stdIn[0]);
            var pts1 = Parse.ParseIntCoordinates(stdIn[1], c1);

            var c2   = Parse.ParseCount(stdIn[2]);
            var pts2 = Parse.ParseIntCoordinates(stdIn[3], c2);

            var p1 = new Polygon2d(pts1);
            var p2 = new Polygon2d(pts2);

            string[] results = new string[2];

            var hull = Polygon2d.Intersects(p1, p2);

            results[0] = hull.Count.ToString();
            results[1] = hull.Select(n => $"{n.X.ToString()} {n.Y.ToString()}").Aggregate((n, m) => m + ' ' + n);

            return(results);
        }