Пример #1
0
        static public System.Collections.Generic.List <Vector2> GrahamScan2DConvexHull(System.Collections.Generic.List <Vector2> input)
        {
            GrahamScanHull gsh = new GrahamScanHull();

            foreach (Vector2 p in input)
            {
                gsh.AddPoint(p);
            }

            gsh.Process();

            return(gsh.hull);
        }
Пример #2
0
        /*
         * Takes a collection of 2d vectors and returns an ordered list of vectors that are
         * the hull
         */
        static public System.Collections.Generic.List <Vector3> GrahamScan2DConvexHull(System.Collections.Generic.List <Vector3> input)
        {
            GrahamScanHull gsh = new GrahamScanHull();

            foreach (Vector3 p in input)
            {
                gsh.AddPoint(p);
            }

            gsh.Process();

            System.Collections.Generic.List <Vector3> res = new System.Collections.Generic.List <Vector3>();

            foreach (Vector2 p in gsh.hull)
            {
                res.Add(p);
            }

            return(res);
        }