Isosurface.ManifoldDC.OctreeNode.ProcessFace C# (CSharp) Method

ProcessFace() public static method

public static ProcessFace ( OctreeNode nodes, int direction, List indexes, List tri_count, float threshold ) : void
nodes OctreeNode
direction int
indexes List
tri_count List
threshold float
return void
        public static void ProcessFace(OctreeNode[] nodes, int direction, List<int> indexes, List<int> tri_count, float threshold)
        {
            if (nodes[0] == null || nodes[1] == null)
                return;

            if (nodes[0].type != NodeType.Leaf || nodes[1].type != NodeType.Leaf)
            {
                for (int i = 0; i < 4; i++)
                {
                    OctreeNode[] face_nodes = new OctreeNode[2];

                    for (int j = 0; j < 2; j++)
                    {
                        if (nodes[j].type == NodeType.Leaf)
                            face_nodes[j] = nodes[j];
                        else
                            face_nodes[j] = nodes[j].children[Utilities.TFaceProcFaceMask[direction, i, j]];
                    }

                    ProcessFace(face_nodes, Utilities.TFaceProcFaceMask[direction, i, 2], indexes, tri_count, threshold);
                }

                int[,] orders =
                {
                    { 0, 0, 1, 1 },
                    { 0, 1, 0, 1 },
                };

                for (int i = 0; i < 4; i++)
                {
                    OctreeNode[] edge_nodes = new OctreeNode[4];

                    for (int j = 0; j < 4; j++)
                    {
                        if (nodes[orders[Utilities.TFaceProcEdgeMask[direction, i, 0], j]].type == NodeType.Leaf)
                            edge_nodes[j] = nodes[orders[Utilities.TFaceProcEdgeMask[direction, i, 0], j]];
                        else
                            edge_nodes[j] = nodes[orders[Utilities.TFaceProcEdgeMask[direction, i, 0], j]].children[Utilities.TFaceProcEdgeMask[direction, i, 1 + j]];
                    }

                    ProcessEdge(edge_nodes, Utilities.TFaceProcEdgeMask[direction, i, 5], indexes, tri_count, threshold);
                }
            }
        }