GenerateGraph.getNodeWithVectorCoordinates C# (CSharp) Method

getNodeWithVectorCoordinates() public method

Returns the node that corresponds to the coordinates of the given Vector3. Checks for the node corresponding to the key constructured from the coordinates in the coordinatesToNode dictionary; if not in the dictionary, creates the node and adds it to the dictionary.
public getNodeWithVectorCoordinates ( Node>.Dictionary &coordinatesToNode, Vector3 givenVector ) : Node,
coordinatesToNode Node>.Dictionary // dictionary containing mappings from the coordinates of a Vector3 to the corresponding // node //
givenVector Vector3 a Vector3
return Node,
    public Node getNodeWithVectorCoordinates(ref Dictionary<string, Node> coordinatesToNode,  
	Vector3 givenVector)
    {
        string vectorKey = givenVector.x + "," + givenVector.y + "," + givenVector.z;
        Node nodeOfVector;
        if (coordinatesToNode.ContainsKey(vectorKey)) {
            nodeOfVector = coordinatesToNode[vectorKey];
        } else {
            nodeOfVector = new Node(givenVector);
            coordinatesToNode.Add(vectorKey, nodeOfVector);
        }
        return nodeOfVector;
    }