Example #1
0
        private void checkneighbors(octan oct, int id)
        {
            if ((id - width) > 0)
            { //read: "check if top left is an edge"
                check(oct.tl, oct.t, oct.l, field.tl);
                check(oct.t, oct.tl, oct.tr, field.t);
                check(oct.tr, oct.t, oct.r, field.tr);
            }

            if (id % width != 0)
            {
                check(oct.l, oct.tl, oct.bl, field.l);
            }

            if ((id + 1) % width != 0)
            {
                check(oct.r, oct.tr, oct.br, field.r);
            }

            if ((id + width) < total)
            {
                check(oct.bl, oct.l, oct.b, field.bl);
                check(oct.b, oct.bl, oct.br, field.b);
                check(oct.br, oct.b, oct.r, field.br);
            }
        }
Example #2
0
        private octan getOctan(int id)
        {
            octan oct = new octan();

            if ((id - width) > 0)
            {
                oct.tl = tree.findNode(sel, id - width - 1);
                oct.t  = tree.findNode(sel, id - width);
                oct.tr = tree.findNode(sel, id - width + 1);
            }

            if (id % width != 0)
            {
                oct.l = tree.findNode(sel, id - 1);
            }

            if ((id + 1) % width != 0)
            {
                oct.r = tree.findNode(sel, id + 1);
            }

            if ((id + width) < total)
            {
                oct.bl = tree.findNode(sel, id + width - 1);
                oct.b  = tree.findNode(sel, id + width);
                oct.br = tree.findNode(sel, id + width + 1);
            }

            return(oct);
        }
Example #3
0
        private void getOctan(int id)
        {
            octan oct = new octan();

            if ((id - width) > 0)
            {
                oct.tl = tree.findNode(sel, id - width - 1);
                oct.t  = tree.findNode(sel, id - width);
                oct.tr = tree.findNode(sel, id - width + 1);
            }

            if (id % width != 0)
            {
                oct.l = tree.findNode(sel, id - 1);
            }

            if ((id + 1) % width != 0)
            {
                oct.r = tree.findNode(sel, id + 1);
            }

            if ((id + width) < total)
            {
                oct.bl = tree.findNode(sel, id + width - 1);
                oct.b  = tree.findNode(sel, id + width);
                oct.br = tree.findNode(sel, id + width + 1);
            }

            if ((id - width) > 0)
            { //read: "check if top left is an edge"
                check(oct.tl, oct.t, oct.l, n.tl);
                check(oct.t, oct.tl, oct.tr, n.t);
                check(oct.tr, oct.t, oct.r, n.tr);
            }

            if (id % width != 0)
            {
                check(oct.l, oct.tl, oct.bl, n.l);
            }

            if ((id + 1) % width != 0)
            {
                check(oct.r, oct.tr, oct.br, n.r);
            }

            if ((id + width) < total)
            {
                check(oct.bl, oct.l, oct.b, n.bl);
                check(oct.b, oct.bl, oct.br, n.b);
                check(oct.br, oct.b, oct.r, n.br);
            }
        }