Module broccoli::node[][src]

Expand description

Contains node-level building block structs and visitors used for a Tree.

Structs

BBox

A bounding box container object that implements Aabb and HasInner. Note that &mut BBox<N,T> also implements Aabb and HasInner.

Node

A node in Tree.

Range

A 1D range. Internally represented as start and end. (as opposed to a start and length) This means that subdivision does not result in any floating point calculations. The start value must be <= the end value. There is no protection against “degenerate” Ranges where start>end. Behavior of any of the functions with degenrate Ranges is unspecified.

Rect

An axis aligned rectangle. Stored as two Ranges. It is a semi-closed rectangle. A point is considered inside the rectangle if it is in [start,end) for both x and y.

VistrMut

Tree Iterator that returns a protected mutable reference to each node.

Traits

Aabb

Trait to signify that this object has an axis aligned bounding box. Multiple calls to Aabb::get() must return a aabb with the same value. This is hard for the user not to do since the user does not have &mut self, but it is still possible through the use of static objects or RefCell / Mutex, etc. Using these type of methods the user could make different calls to get() return different aabbs. This is unsafe since we allow query algorithms to assume the following: If two object’s aabb’s don’t intersect, then they can be mutated at the same time.

Num

The underlying number type used for the tree. It is auto implemented by all types that satisfy the type constraints. Notice that no arithmatic is possible. The tree is constructed using only comparisons and copying.

Type Definitions

Vistr

When we traverse the tree in read-only mode, we can simply return a reference to each node. We don’t need to protect the user from only mutating parts of the BBox’s since they can’t change anything.