protected void ActivateBraidController() { Debug.Log("Creating braid with this controller"); TREE_SIZE = 10; MAIN_RADIUS = 2.5f; _nodeid = 0; BraidNode tree = BraidTreeUtility.CreateInputTree(TREE_SIZE, MAIN_RADIUS); ActivateCPPNSplit(tree, -1.0f); //tree.PrintTree(); CreateBraidVectorsFromTree(tree, 0); Braid b = new Braid("braid_", braidId, braidVectors, null, radiusValues.ToArray()); messenger.AddBraid(b, braidId); BraidSimulationManager.vectorArraysMade++; }
void ActivateCPPNSplit(BraidNode parentNode, float layer) { Vector4 res = CreateOutput(parentNode.data.vector.y, layer); res = NormalizeOutput(res); // check if we should branch and add new node with attached children if (res.w > 0.8f && layer < 1.0f) { layer += 0.5f; BraidNode b = CreateNewNode(parentNode.data.vector.y, layer); parentNode.children.Add(b); BraidTreeUtility.AttachChildren(b, TREE_SIZE - b.Depth, _nodeid++); } parentNode.data.vector += new Vector3(res.x, res.y, res.z); // recursion for the win foreach (BraidNode subNode in parentNode.children) { ActivateCPPNSplit(subNode, layer); } }