/// <inheritdoc /> public NodeSocketView NodeSocketContains(PointF point) { if (NodeBounds.Contains(point)) { foreach (NodeSocketView socket in inSockets) { if (socket.Contains(point)) { return(socket); } } foreach (NodeSocketView socket in outSockets) { if (socket.Contains(point)) { return(socket); } } foreach (NodeSocketView socket in variableSockets) { if (socket.Contains(point)) { return(socket); } } } return(null); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="other"> /// The node whose values should be copied. /// </param> public Node(Node other) { bounds = other.bounds; down = other.down; right = other.right; used = other.used; }
/// <summary> /// Creates a leaf node with the given dimensions, for when a node is split. /// </summary> /// <param name="x"> /// The leftmost edge of the rectangle the node occupies. /// </param> /// <param name="y"> /// The topmost edge of the rectangle the node occupies. /// </param> /// <param name="width"> /// The width of the rectangle the node occupies. /// </param> /// <param name="height"> /// The height of the rectangle the node occupies. /// </param> public Node(int x, int y, int width, int height) { bounds = new NodeBounds(x, y, width, height); down = null; right = null; used = false; }
/// <summary> /// Creates a node with child nodes. /// </summary> /// <param name="down"> /// The node representing the area to the left or top of the separation in the node. /// </param> /// <param name="right"> /// The node representing the area to the right or bottom of the separation in the node. /// </param> public Node(Node down, Node right) { bounds = new NodeBounds(); this.down = down; this.right = right; used = false; }
/// <summary> /// Creates a node with a width/height of 1 and x/y of 0. Used as the root node. /// </summary> public Node() { bounds = new NodeBounds(0, 0, 0, 0); down = null; right = null; used = false; }
public static void TestIsTreeBST() { BinaryTreeNode root = new BinaryTreeNode(4); root.InsertLeft(2); root.Left.InsertLeft(1); root.InsertRight(6); root.Left.Left.InsertLeft(0); // Uncomment following line to render tree just Binary //root.Right.InsertLeft(0); // The bounds in the code below of 0 appears to be useless NodeBounds check = new NodeBounds(root, 0, 0); Console.WriteLine("Given Tree is Binary Search Tree: {0}", check.IsBinarySearchTree(root)); }
private void SetScreenHeightAndWidth() { DeviceLogger.Log("Getting width and height"); var widthAndHeight = Device.Adb.Shell("wm size"); if (string.IsNullOrEmpty(widthAndHeight)) { throw new AdbException("Could not get screen width and height"); } var split = widthAndHeight.Replace(" ", string.Empty).Split(':', 'x'); DeviceLogger.Log($"Width: {split[split.Length - 2]}, Height: {split[split.Length - 1]}"); _screenBounds = new NodeBounds(int.Parse(split[split.Length - 2]), int.Parse(split[split.Length - 1])); }
public OctreeNode RecursiveUpdate(T obj, Vector3 pos) { if (!NodeBounds.Contains(pos)) { Contained.Remove(obj); CheckChildren(); if (Parent != null) { return(Parent.RecursiveUpdate(obj, pos)); } else { throw new System.InvalidOperationException("Node not contained in octree (bounds == " + NodeBounds + ")"); } } return(RecursiveInsert(obj, pos)); }