Translating concave hull algorithm to c#

前端 未结 4 1077
盖世英雄少女心
盖世英雄少女心 2021-01-04 21:31

So I am trying to translate the algorith found here for concave hulls: http://repositorium.sdum.uminho.pt/bitstream/1822/6429/1/ConcaveHull_ACM_MYS.pdf

(Page 65)

4条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-04 22:05

    You have error in

    private static Vertex[] nearestPoints(Vertex[] vs, Vertex v, int k)
    {
        Dictionary lengths = new Dictionary();
        List n = new List();
        double[] sorted = lengths.Keys.OrderBy(d => d).ToArray();
        for (int i = 0; i < k; i++)
        {
            n.Add(lengths[sorted[i]]);
        }
        return n.ToArray();
    }
    

    according to code if you have several vertexes at the same distance, function returns only one. Since Dictionary uses unique keys.

    BTW, did anyone finish this?

提交回复
热议问题