Show / Hide Table of Contents

Class QuadTree<T>

Inheritance
System.Object
QuadTree<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CADability
Assembly: CADability.dll
Syntax
public class QuadTree<T>
    where T : class, IQuadTreeInsertable
Type Parameters
Name Description
T

Constructors

| Improve this Doc View Source

QuadTree()

Declaration
public QuadTree()
| Improve this Doc View Source

QuadTree(BoundingRect)

Declaration
public QuadTree(BoundingRect initialRect)
Parameters
Type Name Description
BoundingRect initialRect

Fields

| Improve this Doc View Source

MaxDeepth

The maximum deepth of the tree. If a node has this deepth no more subnodes will be generated but the list of objects in that node might increase MaxListlen.

Declaration
public int MaxDeepth
Field Value
Type Description
System.Int32
| Improve this Doc View Source

MaxListLen

The maximum number of objects in a leaf-node unless MaxDeepth has been reached

Declaration
public int MaxListLen
Field Value
Type Description
System.Int32

Properties

| Improve this Doc View Source

AllLists

Declaration
public IEnumerable<List<T>> AllLists { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.List<T>>
| Improve this Doc View Source

Size

Declaration
public BoundingRect Size { get; }
Property Value
Type Description
BoundingRect
| Improve this Doc View Source

SomeObject

Declaration
public T SomeObject { get; }
Property Value
Type Description
T

Methods

| Improve this Doc View Source

AddObject(T)

Adds the specified object to the QuadTree

Declaration
public void AddObject(T ObjectToAdd)
Parameters
Type Name Description
T ObjectToAdd

Object to add

| Improve this Doc View Source

AddObjects(List<T>)

Declaration
public void AddObjects(List<T> ObjectsToAdd)
Parameters
Type Name Description
System.Collections.Generic.List<T> ObjectsToAdd
| Improve this Doc View Source

AllObjects()

Returns an enumerator for all objects that are close to the specified bounding rectangle.

Declaration
public IEnumerable<T> AllObjects()
Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Enumerator for those objects

| Improve this Doc View Source

Check(IQuadTreeInsertable, QuadTree<T>.CheckOne)

Declaration
public bool Check(IQuadTreeInsertable closeTo, QuadTree<T>.CheckOne check)
Parameters
Type Name Description
IQuadTreeInsertable closeTo
QuadTree.CheckOne<> check
Returns
Type Description
System.Boolean
| Improve this Doc View Source

GetAllLists()

Declaration
public Pair<BoundingRect, T[]>[] GetAllLists()
Returns
Type Description
Pair<BoundingRect, T[]>[]
| Improve this Doc View Source

GetAllObjects()

Declaration
public T[] GetAllObjects()
Returns
Type Description
T[]
| Improve this Doc View Source

GetObjectsCloseTo(T)

Returns an array of objects that are close to the specified object. The returned objects may or may not interfere with the specified object, but it is guaranteed that all objects touching or intersecting the specified object are in the returned array.

Declaration
public T[] GetObjectsCloseTo(T CloseToThis)
Parameters
Type Name Description
T CloseToThis

Object to filter result with

Returns
Type Description
T[]

Array of all appropriate objects

| Improve this Doc View Source

GetObjectsCloseTo(IQuadTreeInsertable)

Declaration
public T[] GetObjectsCloseTo(IQuadTreeInsertable CloseToThis)
Parameters
Type Name Description
IQuadTreeInsertable CloseToThis
Returns
Type Description
T[]
| Improve this Doc View Source

GetObjectsFromRect(BoundingRect)

Returns an array of objects that are close to the specified bounding rectangle. The objects may overlap the rectangle or even be totaly outside of the rectangle depending on the granularity of the Quadtree. But all objects inside the rectangle or interfering with the rectangle are guaranteed to be returned.

Declaration
public T[] GetObjectsFromRect(BoundingRect r)
Parameters
Type Name Description
BoundingRect r

The filter rectangle

Returns
Type Description
T[]

Array of all appropriate objects

| Improve this Doc View Source

GetObjectsInsideRect(BoundingRect)

Returns an array of objects that are inside the specified bounding rectangle.

Declaration
public T[] GetObjectsInsideRect(BoundingRect r)
Parameters
Type Name Description
BoundingRect r

The filter rectangle

Returns
Type Description
T[]

Array of all appropriate objects

| Improve this Doc View Source

ObjectsCloseTo(T)

Returns an enumerator for all objects that are closed to the specified object. The distance depends upon the granularity of the QuadTree.

Declaration
public IEnumerable<T> ObjectsCloseTo(T CloseToThis)
Parameters
Type Name Description
T CloseToThis

Filter objects close to this object

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Enumertor for those objects

| Improve this Doc View Source

ObjectsCloseTo(IQuadTreeInsertable, Boolean)

Returns an enumerator for all objects that are closed to the specified object. The distance depends upon the granularity of the QuadTree. if eliminateMultiple is false, the same object may be yielded in the enumerator multiple times, but the execution speed is much faster, if eliminateMultiple is true, there will be bookkeeping not to yield the same object multiple times.

Declaration
public IEnumerable<T> ObjectsCloseTo(IQuadTreeInsertable CloseToThis, bool eliminateMultiple)
Parameters
Type Name Description
IQuadTreeInsertable CloseToThis

Filter objects close to this object

System.Boolean eliminateMultiple

false: fast mode, multiple yields, true: single yield per object

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Enumertor for those objects

| Improve this Doc View Source

ObjectsFromRect(BoundingRect)

Returns an enumerator for all objects that are close to the specified bounding rectangle.

Declaration
public IEnumerable<T> ObjectsFromRect(BoundingRect r)
Parameters
Type Name Description
BoundingRect r

The rectangle to filter objects

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Enumerator for those objects

| Improve this Doc View Source

ObjectsInsideRect(BoundingRect)

Returns an enumerator for all objects that are completely inside the specified bounding rectangle.

Declaration
public IEnumerable<T> ObjectsInsideRect(BoundingRect r)
Parameters
Type Name Description
BoundingRect r

The rectangle to filter objects

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Enumerator for those objects

| Improve this Doc View Source

RemoveObject(T)

Removes the specified object from the QuadTree

Declaration
public void RemoveObject(T ObjectToRemove)
Parameters
Type Name Description
T ObjectToRemove

Object to remove

| Improve this Doc View Source

RemoveObjects(List<T>)

Declaration
public void RemoveObjects(List<T> ObjectsToRemove)
Parameters
Type Name Description
System.Collections.Generic.List<T> ObjectsToRemove
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX