Node3d.T.
Basic node in a Tree3d structure. Nodes in tree structures maintain a local region and either a list of content indices or a list of up to 8 child nodes.
Inheritance Hierarchy
System.Object
Grasshopper.Kernel.Geometry.SpatialTrees.Node3d.T.
Namespace: Grasshopper.Kernel.Geometry.SpatialTrees
Assembly: Grasshopper (in Grasshopper.dll)
Syntax
public sealed class Node3d<T>
T
The Node3d.T. type exposes the following members.
Constructors
Name
Description
Public Method
Node3d.T.(Coordinates3d.T., BoundingBox)
Create a new spatial tree root.
Public Method
Node3d.T.(Coordinates3d.T., BoundingBox, Int32)
Create a new spatial tree root.
Properties
Name
Description
Public Property
Center
Gets the center of the spatial region of this node. If the node contains no children the center is always in the middle of the Region. If the node does contain child-nodes, the center may be anywhere within the region.
Public Property
ChildCount
Gets the number of defined child nodes. Leaf nodes have no children. Root and twig nodes can have anywhere between 1 and 8 children.
Public Property
ChildNode
Gets the child node at the given index.
Public Property
ContentAverage
Returns the average coordinate of all items in this node. If this node does not contain any items, Point3d.Unset is returned.
Public Property
ContentBoundingBox
Returns the boundingbox of all items in this node. If this node does not contain any items, BoundingBox.Empty is returned.
Public Property
IndicesLocal
Gets the list of item indices that are contained within this node.
Public Property
IndicesRecursive
Gets the list of item indices that are contained within this node and any child nodes.
Public Property
IsLeaf
Gets whether this node is a leaf node. Leaf nodes have no child nodes.
Public Property
IsMutable
Gets whether this tree is mutable. You can only add items to mutable trees. We don’t recommend removing items from unmutable trees, though that shouldn’t necessarily lead to problems. Trees become unmutable after a call to ShrinkRegions(), CollapseNodes() or OptimizeTree().
Public Property
IsRoot
Gets whether this node is a root node. Root nodes have no parent node and depth zero.
Public Property
IsTwig
Gets whether this node is a twig node. Twig nodes have both parents and at least one child.
Public Property
ItemCount
Gets the total number of items stored directly in this node.
Public Property
ItemsGlobal
Gets the list of all items stored inside this entire tree. Do not modify this collection unless you know what you are doing.
Public Property
ItemsLocal
Gets a list of all the items stored directly in this node. This list is constructed every time you access this property, so keep it down to a minimum.
Public Property
Limit
Gets the subdivision limit for this tree. This limit can only be set once when you create a new tree. It is fixed forever after.
Public Property
MemoryConsumption
Gets the estimated memory consumption of the (sub)tree structure. Items inside the global list are not included in this estimate.
Public Property
NextNode
Gets the logical neighbour to the right of this node. There is no spatial relationships between logical neighbours, this is purely an iteration aid.
Public Property
NodeDepth
Gets the recursive depth of this node. The tree root is at depth zero. The first subdivision is at depth one, and so on and so forth.
Public Property
ParentNode
Gets the immediate parent of this node. Root nodes have no parent.
Public Property
Region
Gets the spatial region of this node.
Public Property
RootNode
Gets the ultimate root node for this tree.
Public Property
WeightedSubdivision
Gets or sets whether subdivision is weighted based on content averages. Setting this value will only affect future subdivisions, not existing ones.
Methods
Name
Description
Public Method
Add
Insert another item into the tree. The item should be within the region of this node.
Public Method
AddRange
Insert a collection of items into the tree. The items should all be within the region of this node.
Public Method
AddToRhinoDocument
Public Method
CollapseNodes
Collapse the (sub)tree rooted at this node. Collapsing happens when a node only has a single child, in which case the child usurps the position previously held by the parent. Do not collapse a (sub)tree if you still plan to add items later.
Public Method
FurthestItem(T)
Find the furtest item.
Public Method
FurthestItem(Point3d)
Find the furtest item.
Public Method
FurthestItem(Double, Double, Double)
Find the furtest item.
Public Method
FurthestItem(T, Double, Double)
Find the furtest item.
Public Method
FurthestItem(Point3d, Double, Double)
Find the furtest item.
Public Method
FurthestItem(Double, Double, Double, Double, Double)
Find the furtest item.
Public Method
NearestItem(T)
Find the nearest item.
Public Method
NearestItem(Point3d)
Find the nearest item.
Public Method
NearestItem(Double, Double, Double)
Find the nearest item.
Public Method
NearestItem(T, Double, Double)
Find the nearest item.
Public Method
NearestItem(Point3d, Double, Double)
Find the nearest item.
Public Method
NearestItem(Double, Double, Double, Validation3d.T.)
Find the nearest item using custom validation criteria.
Public Method
NearestItem(Double, Double, Double, Double, Double)
Find the nearest item.
Public Method
NearestItems(T, Int32)
Find the N nearest items.
Public Method
NearestItems(Double, Double, Double, Int32)
Find the N nearest items.
Public Method
NearestItems(T, Int32, Double, Double)
Find the N nearest items.
Public Method
NearestItems(Double, Double, Double, Int32, Double, Double)
Find the N nearest items.
Public Method
OptimizeTree
Optimize this tree for fast searches. Do not call this method if you still plan to add items in the future. You can no longer modify this tree once it has been optimized.
Public Method
Remove(Index3d.T.)
Remove the item with the given index from the entire tree. It doesn’t matter on which node you call this function, it is a tree-wide operation.
Public Method
Remove(Int32)
Remove the item with the given index from the entire tree. It doesn’t matter on which node you call this function, it is a tree-wide operation.
Public Method
ShrinkRegions
Shrink the region for this node and all child nodes. Do not use this method if you intend to add more items later as it creates spatial gaps in the tree structure. You can shrink nodes if you’re done adding items and want to start searching the tree.
Public Method
SubTree
Gets an iterator for all nodes in this (sub)tree.
Public Method
TrimExcess
Trim the excess space on all index lists. You can call this method to reduce memory usage. It will not modify the tree in any functional way.