Esempio n. 1
0
            public static List <Hierarchy> Sort(Hierarchy parent)
            {
                ChildRingSorter sorter = new ChildRingSorter(parent);
                int             _      = 0;
                var             tuples = parent
                                         .children
                                         .ConvertAll(c => new Tuple <Hierarchy, float>(c, c.ring.RingDist(parent.ring, ref _, ref _)));

                tuples.Sort(sorter);
                return(tuples.ConvertAll(c => c.Item1));
            }
Esempio n. 2
0
        private void ReduceInto(List <Ring> res)
        {
            Ring resRing = ring;

            // while sorting here is a decent solution,
            //   it is not complete, and it can be fooled.
            foreach (var child in ChildRingSorter.Sort(this))
            {
                resRing = JoinRings(resRing, child.ring);
                child.ReduceChildrenInto(res);
            }
            res.Add(resRing);
        }
Esempio n. 3
0
        // ------------------------------------
        // Reduce to simple rings recursively
        // ------------------------------------
        public List <Ring> Reduce()
        {
            List <Ring> res     = new List <Ring>();
            Ring        resRing = ring;

            // while sorting here is a decent solution,
            //   it is not complete, and it can be fooled.
            foreach (var child in ChildRingSorter.Sort(this))
            {
                resRing = JoinRings(resRing, child.ring);
                child.ReduceChildrenInto(res);
            }
            res.Add(resRing);
            return(res);
        }