JXG.Math.BoxQuadtree

Class

Members

Own

(private) bbox : Array

Description

Bounding box [left, top, right, bottom].

Type
Array
Source
math/bqdt.js, line 117

(private) capacity : Number

Description

Capacity of the box quadtree node

Type
Number
Source
math/bqdt.js, line 68

(private) cx : Number

Description

x-coordinate of bounding box center.

Type
Number
Source
math/bqdt.js, line 126

(private) cy : Number

Description

y-coordinate of bounding box center.

Type
Number
Source
math/bqdt.js, line 135

(private) depth : Number

Description

Maximum depth of the box quadtree node

Type
Number
Source
math/bqdt.js, line 60

(private) items : Array

Description

Item storage.

Type
Array
Source
math/bqdt.js, line 76

(private) northEast : JXG.Math.BoxQuadtree

Description

In a subdivided quadtree this represents the top right subtree.

Type
JXG.Math.BoxQuadtree
Source
math/bqdt.js, line 93

(private) northWest : JXG.Math.BoxQuadtree

Description

In a subdivided quadtree this represents the top left subtree.

Type
JXG.Math.BoxQuadtree
Source
math/bqdt.js, line 85

(private) southEast : JXG.Math.BoxQuadtree

Description

In a subdivided quadtree this represents the bottom right subtree.

Type
JXG.Math.BoxQuadtree
Source
math/bqdt.js, line 101

(private) southWest : JXG.Math.BoxQuadtree

Description

In a subdivided quadtree this represents the bottom left subtree.

Type
JXG.Math.BoxQuadtree
Source
math/bqdt.js, line 109

Inherited

none

Methods

Own

analyzeTree() → {Object}

Analyze the box quadtree.

Returns

data about the box quadtree

Type
Object

Details

Source
math/bqdt.js, line 402

find(box) → {Array}

Find all entries of the box quadtree which have an overlap with the given rectangle (AABB). Items may appear multiple times.

Parameters

Name Type Description
box Array

AABB of the form [l, t, r, b]

Returns

list of items overlapping with box

Type
Array

Details

Source
math/bqdt.js, line 366

insert(items) → {Object}

Insert an array of items into the box quadtree. An item is an object containing at least the properties

  • xlb: lower bound on x
  • xub: upper bound on x
  • ylb: lower bound on y
  • yub: upper bound on y

which define the axis-aligned bounding box (AABB) of that item. Additionally, more properties can be given.

Parameters

Name Type Description
items Array

to be inserted

Returns

reference to the box quadtree

Type
Object

Details

Source
math/bqdt.js, line 175

insertItem(it) → {Object}

Insert an item into the box quadtree, where an item is an object containing at least the properties

  • xlb: lower bound on x
  • xub: upper bound on x
  • ylb: lower bound on y
  • yub: upper bound on y

which define the axis-aligned bounding box (AABB) of that item. Additionally, more properties can be given.

Parameters

Name Type Description
it Object

Item to be inserted

Returns

reference to the box quadtree

Type
Object

Details

Source
math/bqdt.js, line 260

plot() → {Array}

Generate data to plot the box quadtree as curve using updateDataArray.

Example

// qdt contains a BoxQuadtree

var qdtcurve = board.create('curve', [[], []], { strokeWidth: 1, strokeColor: '#0000ff', strokeOpacity: 0.3 });
qdtcurve.updateDataArray = function () {
   var ret = qdt.plot();

   this.dataX = ret[0];
   this.dataY = ret[1];
   console.log(qdt.analyzeTree());
};
board.update();

Returns

containing arrays dataX and dataY

Type
Array

Details

Source
math/bqdt.js, line 451

(private) subdivide(nw_it, sw_it, ne_it, se_it, l, t, r, b) → {Object}

Create the sub-quadrants if necessary, recursively

Parameters

Name Type Description
nw_it Array

list of items for northWest subtree

sw_it Array

list of items for southWest subtree

ne_it Array

list of items for northEast subtree

se_it Array

list of items for southEast subtree

l Number

bounding box left

t Number

bounding box top

r Number

bounding box right

b Number

bounding box bottom

Returns

reference to the box quadtree

Type
Object

Details

Source
math/bqdt.js, line 330

Inherited

none

Parameters

Name Type Attributes Description
depth Number

Maximum recursion depth.

capacity Number

Maximum number of items stored in this node.

bbox Array <optional>

Optional bounding box of the box quadtree. If not given, the bounding box is determined by the items in the insert method. This will only work correctly if the first call of insert contains the maximum bounding box.

Details

Source
math/bqdt.js, line 38