Show / Hide Table of Contents

Class OctTree<T>

Generic class to privide fast access to IOctTreeInsertable implementing objects.

Inheritance
System.Object
OctTree<T>
BRepOperation
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 OctTree<T>
    where T : IOctTreeInsertable
Type Parameters
Name Description
T

The generic type, must implement IOctTreeInsertable

Constructors

| Improve this Doc View Source

OctTree()

Declaration
public OctTree()
| Improve this Doc View Source

OctTree(BoundingCube, Double, OctTree<T>.SplitTestFunction)

Declaration
public OctTree(BoundingCube ext, double precision, OctTree<T>.SplitTestFunction splitTest = null)
Parameters
Type Name Description
BoundingCube ext
System.Double precision
OctTree.SplitTestFunction<> splitTest

Fields

| Improve this Doc View Source

node

The root OctTree<T>.Node<TT> of this octtree

Declaration
protected OctTree<T>.Node<T> node
Field Value
Type Description
OctTree.Node<T>
| Improve this Doc View Source

precision

The precision of this octtree

Declaration
public double precision
Field Value
Type Description
System.Double

Properties

| Improve this Doc View Source

Extend

returns the extend of the root node.

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

IsEmpty

Returns true if the tree is empty

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
System.Boolean

Methods

| Improve this Doc View Source

AddMany(IEnumerable<T>)

Declaration
public void AddMany(IEnumerable<T> objectsToAdd)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<T> objectsToAdd
| Improve this Doc View Source

AddObject(T)

Add the provided object to the tree. This may split some nodes and cause calls to the method of other objects already in the tree.

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

Object beeing added

| Improve this Doc View Source

AddObjectAsync(T)

Declaration
public void AddObjectAsync(T objectToAdd)
Parameters
Type Name Description
T objectToAdd
| Improve this Doc View Source

FindExactNode(BoundingCube)

Find the node which corresponds exactely to the provided boundingcube

Declaration
public OctTree<T>.Node<T> FindExactNode(BoundingCube bc)
Parameters
Type Name Description
BoundingCube bc
Returns
Type Description
OctTree.Node<T>
| Improve this Doc View Source

FindNode(GeoPoint)

Find the node containing the provided point.

Declaration
public OctTree<T>.Node<T> FindNode(GeoPoint center)
Parameters
Type Name Description
GeoPoint center

the point

Returns
Type Description
OctTree.Node<T>

the node or null if outside

| Improve this Doc View Source

GetAllObjects()

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

GetNeighbourNodes(OctTree<T>.Node<T>, OctTree<T>.FilterNode)

Returns all neighbour nodes to the provided node. The result is sortet in a 2-dimensional array where the first index defines the side according to OctTree<T>.Side.

Declaration
protected OctTree<T>.Node<T>[][] GetNeighbourNodes(OctTree<T>.Node<T> node, OctTree<T>.FilterNode filter)
Parameters
Type Name Description
OctTree.Node<T> node

The node which neighbours are requested

OctTree.FilterNode<> filter

A optinal filter or null if unfiltered

Returns
Type Description
OctTree.Node<T>[][]

The neighbour nodes

| Improve this Doc View Source

GetNeighbours(OctTree<T>.Node<T>, OctTree<T>.Filter)

Returns all neighbours to the provided node. The result is sortet in a 2-dimensional array where the first index defines the side according to OctTree<T>.Side.

Declaration
protected T[][] GetNeighbours(OctTree<T>.Node<T> node, OctTree<T>.Filter filter)
Parameters
Type Name Description
OctTree.Node<T> node

The node which neighbours are requested

OctTree.Filter<> filter

A optinal filter or null if unfiltered

Returns
Type Description
T[][]

The neighbours

| Improve this Doc View Source

GetNodesCloseTo(IOctTreeInsertable)

Returns all nodes close to the provided object.

Declaration
protected OctTree<T>.Node<T>[] GetNodesCloseTo(IOctTreeInsertable closeToThis)
Parameters
Type Name Description
IOctTreeInsertable closeToThis

Object for selection

Returns
Type Description
OctTree.Node<T>[]

All nodes interfering with the provided object

| Improve this Doc View Source

GetNodesFromBox(BoundingCube, OctTree<T>.FilterNode)

Returns all nodes of this tree that interfere with the provided box and pass the filter test.

Declaration
public OctTree<T>.Node<T>[] GetNodesFromBox(BoundingCube box, OctTree<T>.FilterNode filter)
Parameters
Type Name Description
BoundingCube box

Restricting box

OctTree.FilterNode<> filter

Additional filter (may be null)

Returns
Type Description
OctTree.Node<T>[]

All nodes which match the criterion

| Improve this Doc View Source

GetObjectsCloseTo(IOctTreeInsertable)

Returns all objects that are close to the provided object.

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

Object which neighbours are searched

Returns
Type Description
T[]

All objects close to closeToThis

| Improve this Doc View Source

GetObjectsFromBox(BoundingCube)

Returns all objects that interfere or are close to the provided box.

Declaration
public T[] GetObjectsFromBox(BoundingCube box)
Parameters
Type Name Description
BoundingCube box

Box for the selection

Returns
Type Description
T[]

Array of all objects which match the criterion

| Improve this Doc View Source

GetObjectsFromBox(BoundingCube, OctTree<T>.Filter)

Returns all objects that interfere or are close to the provided box and accepted by the filter.

Declaration
public T[] GetObjectsFromBox(BoundingCube box, OctTree<T>.Filter filter)
Parameters
Type Name Description
BoundingCube box

Box specifying the selection

OctTree.Filter<> filter

Filter restriction the result

Returns
Type Description
T[]

Array of all objects which match the criterion

| Improve this Doc View Source

GetObjectsFromLine(GeoPoint, GeoVector, Double)

Returns an array of objects which contains all objects that are close to the provided line. It may also contain some objects that have a greater distance than maxdist to the line.

Declaration
public T[] GetObjectsFromLine(GeoPoint start, GeoVector dir, double maxdist)
Parameters
Type Name Description
GeoPoint start

Starting point of the line

GeoVector dir

Direction of the line

System.Double maxdist

Maximum distance to the line

Returns
Type Description
T[]

Array of all objects which match the criterion

| Improve this Doc View Source

GetObjectsFromPlane(Plane)

Returns all objects that are close to the provided plane

Declaration
public T[] GetObjectsFromPlane(Plane plane)
Parameters
Type Name Description
Plane plane

Plane for selection

Returns
Type Description
T[]

All objects close to the plane

| Improve this Doc View Source

GetObjectsFromPoint(GeoPoint)

Returns all objects that are close to the provided point.

Declaration
public T[] GetObjectsFromPoint(GeoPoint p)
Parameters
Type Name Description
GeoPoint p

Point for selection

Returns
Type Description
T[]

Array of all objects which match the criterion

| Improve this Doc View Source

GetObjectsFromRect(Projection, BoundingRect, Boolean)

Returns an array of all objects that interfere with the provided rectangle in repect to the provided Projection. It may also contain some objects which don't interfere but are close to the rectangle, if onlyInside is false.

Declaration
public T[] GetObjectsFromRect(Projection projection, BoundingRect rect, bool onlyInside)
Parameters
Type Name Description
Projection projection

The projection

BoundingRect rect

The rectangle, usually from a selection

System.Boolean onlyInside

If true, only objects completely inside the rectangle are returned

Returns
Type Description
T[]

Array of all objects which match the criterion

| Improve this Doc View Source

GetObjectsFromRect(Projection.PickArea, Boolean)

Returns an array of all objects that interfere with the provided Projection.PickArea area. If onlyInside is true only objects inside the frustum or box of the area are returned, otherwise there may also be objects that are aoutside this area.

Declaration
public T[] GetObjectsFromRect(Projection.PickArea area, bool onlyInside)
Parameters
Type Name Description
Projection.PickArea area

the frustum or box defining the selection

System.Boolean onlyInside

True to only return objects completely inside the area

Returns
Type Description
T[]

Array of all objects which match the criterion

| Improve this Doc View Source

Initialize(BoundingCube, Double)

Declaration
public void Initialize(BoundingCube ext, double precision)
Parameters
Type Name Description
BoundingCube ext
System.Double precision
| Improve this Doc View Source

InitializePrecise(BoundingCube, Double)

Declaration
public void InitializePrecise(BoundingCube ext, double precision)
Parameters
Type Name Description
BoundingCube ext
System.Double precision
| Improve this Doc View Source

RemoveObject(T)

Remove object from the tree

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

object to bee removed

| Improve this Doc View Source

SplitNode(OctTree<T>.Node<T>, T)

Criterion whether to split a node when it contains too many leaves. The default implemenation yield a dynamically balanced tree which allows more leaves in deeper nodes.

Declaration
protected virtual bool SplitNode(OctTree<T>.Node<T> node, T objectToAdd)
Parameters
Type Name Description
OctTree.Node<T> node

The node beeing checked

T objectToAdd

The object beeing added

Returns
Type Description
System.Boolean

true, if node should be splitted, false otherwise

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX