RTree
ReferencesRepresents a spatial search structure based on implementations of the R-tree algorithm by Toni Gutman.
Remarks: The opennurbs rtree code is a modified version of the free and unrestricted R-tree implementation obtained from http://www.superliminal.com/sources/sources.htm .
Constructors
Finalizer
~RTree
#Passively reclaims unmanaged resources when the class user did not explicitly call Dispose().
~RTree()
Properties
Methods
Constructs a new tree with an element for each point cloud point.
Returns: A new tree, or null on error.
Constructs a new tree with an element for each face in the mesh. The element id is set to the index of the face.
Returns: A new tree, or null on error.
Constructs a new tree with an element for each point cloud point.
Returns: A new tree, or null on error.
Actively reclaims unmanaged resources that this instance uses.
public void Dispose()
Dispose
#For derived class implementers.
This method is called with argument true when class user calls Dispose(), while with argument false when the Garbage Collector invokes the finalizer, or Finalize() method.
You must reclaim all used unmanaged resources in both cases, and can use this chance to call Dispose on disposable fields if the argument is true.
Also, you must call the base virtual method within your overriding method.
protected virtual void Dispose()
disposing
true if the call comes from the Dispose() method; false if it comes from the Garbage Collector finalizer.
Inserts an element into the tree.
Returns: true if element was successfully inserted.
Inserts an element into the tree.
Returns: true if element was successfully inserted.
Inserts an element into the tree.
Returns: true if element was successfully inserted.
Inserts an element into the tree.
Returns: true if element was successfully inserted.
Inserts an element into the tree.
Returns: true if element was successfully inserted.
Inserts an element into the tree.
Returns: true if element was successfully inserted.
Finds the point in a list of 3D points that is closest to a test point.
public static IEnumerable<int[]> Point3dClosestPoints()
hayPoints,
A series of points.
needlePts,
Points to search for.
limitDistance
The maximum allowed distance.
Returns: An enumerable of arrays of indices; each array contains the indices for each of the needlePts.
Finds a certain amount of points in a list of 3D points that are the k-closest to a test point.
public static IEnumerable<int[]> Point3dKNeighbors()
hayPoints,
A series of points.
needlePts,
Points to search for.
amount
The required amount of closest neighbors to find.
Returns: An enumerable of arrays of indices; each array contains the indices for each of the needlePts.
Finds the point in a list of 3D points that is closest to a test point.
public static IEnumerable<int[]> PointCloudClosestPoints()
pointcloud,
A point cloud to be searched.
needlePts,
Points to search for.
limitDistance
The maximum allowed distance.
Returns: An enumerable of arrays of indices; each array contains the indices for each of the needlePts.
Finds a certain amount of points in a list of 3D points that are the k-closest to a test point.
public static IEnumerable<int[]> PointCloudKNeighbors()
pointcloud,
A point cloud to be searched.
needlePts,
Points to search for.
amount
The required amount of closest neighbors to find.
Returns: An enumerable of arrays of indices; each array contains the indices for each of the needlePts.
Removes an element from the tree.
Returns: true if element was successfully removed.
Removes an element from the tree.
Returns: true if element was successfully removed.
Removes an element from the tree.
Returns: true if element was successfully removed.
Removes an element from the tree.
Returns: true if element was successfully removed.
Removes an element from the tree.
Returns: true if element was successfully removed.
Searches for items in a bounding box.
The bounding box can be singular and contain exactly one single point.
public bool Search()
box,
A bounding box.
callback,
An event handler to be raised when items are found.
tag
State to be passed inside the RTreeEventArgs Tag property.
Remarks: Do not modify the tree while a Search() is in progress. Doing so can have unintended consequences, including corruption and crashes.If you need to modify the tree, collect the results during the search and modify the tree once the search is completed.
Returns: true if entire tree was searched. It is possible no results were found.
Searches for items in a bounding box.
The bounding box can be singular and contain exactly one single point.
Remarks: Do not modify the tree while a Search() is in progress. Doing so can have unintended consequences, including corruption and crashes.If you need to modify the tree, collect the results during the search and modify the tree once the search is completed.
Returns: true if entire tree was searched. It is possible no results were found.
Searches for items in a sphere.
public bool Search()
sphere,
bounds used for searching.
callback,
An event handler to be raised when items are found.
tag
State to be passed inside the RTreeEventArgs Tag property.
Remarks: Do not modify the tree while a Search() is in progress. Doing so can have unintended consequences, including corruption and crashes.If you need to modify the tree, collect the results during the search and modify the tree once the search is completed.
Returns: true if entire tree was searched. It is possible no results were found.
Searches for items in a sphere.
public bool Search()
sphere,
bounds used for searching.
callback
An event handler to be raised when items are found.
Remarks: Do not modify the tree while a Search() is in progress. Doing so can have unintended consequences, including corruption and crashes.If you need to modify the tree, collect the results during the search and modify the tree once the search is completed.
Returns: true if entire tree was searched. It is possible no results were found.
Searches for pairs of bounding boxes that overlap.
public bool SearchOverlaps()
tolerance,
bounds used for searching.
callback,
An event handler to be raised when items are found.
tag
State to be passed inside the RTreeEventArgs Tag property.
Remarks: Do not modify the tree while a Search() is in progress. Doing so can have unintended consequences, including corruption and crashes.If you need to modify the tree, collect the results during the search and modify the tree once the search is completed.
Returns: true if entire tree was searched. It is possible no results were found.
Searches two R-trees for all pairs elements whose bounding boxes overlap.
public static bool SearchOverlaps()
treeA,
A first tree.
treeB,
A second tree.
tolerance,
If the distance between a pair of bounding boxes is less than tolerance, then callback is called.
callback
A callback event handler.
Remarks: Do not modify the tree while a Search() is in progress. Doing so can have unintended consequences, including corruption and crashes.If you need to modify the tree, collect the results during the search and modify the tree once the search is completed.
Returns: true if entire tree was searched. It is possible no results were found.