public void AddNode(float inputValue, float outputOpacity, Vector3 outputColor) { var newNode = new TfNode(inputValue, outputOpacity, outputColor); Nodes.Add(newNode); SortListOfTfNodes(); }
private void GetNeighboringNodes(float voxelValue, out TfNode lowerNode, out TfNode higherNode) { TfNode previousNode = Nodes[0]; // Could use binary search or other strategy for efficiency if required for (int i = 1; i < Nodes.Count; i++) { var currentNode = Nodes[i]; if (previousNode.InputValue <= voxelValue && currentNode.InputValue >= voxelValue) { lowerNode = previousNode; higherNode = currentNode; return; } previousNode = currentNode; } throw new InvalidOperationException("You have asked for a point that is not between two TF nodes."); }