private static void Accumulate(DirectedNode Graph, int LastID, int Addition) { int count = checked (Graph.Children.Count - 1); for (int i = 0; i <= count; i = checked (i + 1)) { if (Graph.Children[i].ID != LastID) { Graph.Children[i].Value = Math.Max(Graph.Children[i].Value, Graph.Value + 6 + (double)Addition); } else { Graph.Children[i].Value = Math.Max(Graph.Children[i].Value, Graph.Value + 3 + (double)Addition); } DirectedNode.Accumulate(Graph.Children[i], LastID, Addition); } }
public static void ComputeMeshCounts(DirectedNode Graph, int AddFaces = 0) { Graph.Value = 4; List <DirectedNode> leafs = Graph.GetLeafs(); leafs[0].Value = 3; DirectedNode.Accumulate(Graph, leafs[0].ID, AddFaces); DirectedNode.CorrectValues(Graph, leafs[0].ID); leafs[0].Value = 3; SortedList <int, DirectedNode> nums = new SortedList <int, DirectedNode>(); DirectedNode.FlatTree(Graph, ref nums); int count = checked (nums.Count - 1); for (int i = 0; i <= count; i = checked (i + 1)) { DirectedNode item = nums[nums.Keys[i]]; item.Value = item.Value + (double)AddFaces; } }