2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [TreeNode](treenode.md)
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
# Class: TreeNode ‹**T**›
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
A node in the dynamic tree. The client does not interact with this directly.
|
|
|
|
|
|
|
|
|
|
|
|
## Type parameters
|
|
|
|
|
|
|
|
|
|
|
|
▪ **T**
|
|
|
|
|
|
|
2020-07-27 00:12:01 -07:00
|
|
|
|
## Hierarchy
|
|
|
|
|
|
|
|
|
|
|
|
* **TreeNode**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
|
|
|
|
* [constructor](treenode.md#constructor)
|
|
|
|
|
|
|
2020-07-27 00:12:01 -07:00
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
|
|
|
|
* [aabb](treenode.md#aabb)
|
|
|
|
|
|
* [child1](treenode.md#child1)
|
|
|
|
|
|
* [child2](treenode.md#child2)
|
|
|
|
|
|
* [height](treenode.md#height)
|
|
|
|
|
|
* [id](treenode.md#id)
|
|
|
|
|
|
* [parent](treenode.md#parent)
|
|
|
|
|
|
* [userData](treenode.md#userdata)
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
|
|
|
|
* [isLeaf](treenode.md#isleaf)
|
|
|
|
|
|
* [toString](treenode.md#tostring)
|
|
|
|
|
|
|
|
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
\+ **new TreeNode**(`id?`: number): *[TreeNode](treenode.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L50)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-11 18:30:36 -07:00
|
|
|
|
`id?` | number |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *[TreeNode](treenode.md)*
|
|
|
|
|
|
|
2020-07-27 00:12:01 -07:00
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
|
|
### aabb
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **aabb**: *[AABB](aabb.md)* = new AABB()
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:44](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L44)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
Enlarged AABB
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### child1
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **child1**: *[TreeNode](treenode.md)‹T›* = null
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:47](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L47)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### child2
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **child2**: *[TreeNode](treenode.md)‹T›* = null
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L48)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### height
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
• **height**: *number* = -1
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L50)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
0: leaf, -1: free node
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### id
|
|
|
|
|
|
|
|
|
|
|
|
• **id**: *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:42](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L42)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### parent
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **parent**: *[TreeNode](treenode.md)‹T›* = null
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:46](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L46)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### userData
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
• **userData**: *T* = null
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:45](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L45)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
|
|
### isLeaf
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isLeaf**(): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:60](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L60)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### toString
|
|
|
|
|
|
|
|
|
|
|
|
▸ **toString**(): *string*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/DynamicTree.ts:56](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/DynamicTree.ts#L56)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
**Returns:** *string*
|