Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D Documentation
The DynamicBoundingVolumeTreeNode2D represents a node in the DynamicBoundingVolumeTree2D class. A DynamicBoundingVolumeTreeNode2D represents a BoundingBox2D which represents an item in the game. This node stores its parent in the tree as well as any children of the node. Additionally, the node's height in the tree and ID in integer are stored. By default, the node's treeParent, itemNode, leftChild, and rightChild are undefined. The node id and height are, by default, -1. This class is used internally by DynamicBoundingVolumeTree2D.
Example Code
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Game.Collision.Item2DNode
DynamicBoundingVolumeTreeNode2D newNode
Item2DNode node
BoundingBox2D boundingBox
Vector2 boxMinimum
Vector2 boxMaximum
boxMinimum:Set(-1, -1)
boxMaximum:Set(1, 1)
newNode:SetID(0)
BoundingBox2D nodeBoundingBox = newNode:GetBoundingBox()
Vector2 minimum
Vector2 maximum
minimum:Set(boundingBox:GetMinimum())
maximum:Set(boundingBox:GetMaximum())
nodeBoundingBox:Set(minimum, maximum)
newNode:SetItemNode(node)
Inherits from: Libraries.Language.Object
Actions Documentation
Compare(Libraries.Language.Object object)
This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.
Parameters
- Libraries.Language.Object: The object to compare to.
Return
integer: The Compare result, Smaller, Equal, or Larger.
Example
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)
Equals(Libraries.Language.Object object)
This action determines if two objects are equal based on their hash code values.
Parameters
- Libraries.Language.Object: The to be compared.
Return
boolean: True if the hash codes are equal and false if they are not equal.
Example
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(t)
GetBoundingBox()
This action returns the BoundingBox2D which this node represents. This action is used internally.
Return
Libraries.Game.Collision.BoundingBox2D: The BoundingBox2D represented by this tree node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.BoundingBox2D
DynamicBoundingVolumeTreeNode2D node
BoundingBox2D boundingBox
boundingBox = node:GetBoundingBox()
GetHashCode()
This action gets the hash code for an object.
Return
integer: The integer hash code of the object.
Example
Object o
integer hash = o:GetHashCode()
GetHeight()
This action returns the integer height of this node in the DynamicBoundingVolumeTree2D. This action is used internally.
Return
integer: The integer height of this tree node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
output "Node " + node:GetID() + " is at height " + node:GetHeight()
GetID()
This action gets the id of this node. This action is used internally.
Return
integer: The id of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.DynamicBoundingVolumeTree2D
DynamicBoundingVolumeTree2D tree
DynamicBoundingVolumeTreeNode2D newNode
newNode:SetID(0)
integer id = newNode:GetID()
GetItemNode()
This action returns the Item2DNode in the Dynamic Bounding Volume Tree Node (2D), which has among its data members a BoundingBox2D and an Item2D. This action is used internally.
Return
Libraries.Game.Collision.Item2DNode: The item2DNode in this tree node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.Item2DNode
DynamicBoundingVolumeTreeNode2D node
Item2DNode itemNode
itemNode = node:GetItemNode
GetLeftChild()
This action returns the DynamicBoundingVolumeTreeNode2D which is the left child of this node. This action is used internally.
Return
Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D: The DynamicBoundingVolumeTreeNode2D left child of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D leftNode
leftNode:SetID(1)
node:SetLeftChild(leftNode)
output "The left child of this node is node " + node:GetLeftChild():GetID()
GetParent()
This action returns the DynamicBoundingVolumeTreeNode2D which is the parent of this node. This action is used internally.
Return
Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D: The DynamicBoundingVolumeTreeNode2D parent of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D parentNode
parentNode:SetID(1)
node:SetParent(parentNode)
output "The parent of this node is node " + node:GetParent():GetID()
GetRightChild()
This action returns the DynamicBoundingVolumeTreeNode2D which is the right child of this node. This action is used internally.
Return
Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D: The DynamicBoundingVolumeTreeNode2D right child of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D rightNode
rightNode:SetID(1)
node:SetRightChild(rightNode)
output "The right child of this node is node " + node:GetRightChild():GetID()
IsLeaf()
This action returns true if this node is a leaf (i.e. has no children) and false if this node has children. Attribute Returns boolean The boolean that indicates whether or not this node is a leaf
Return
boolean:
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D leftNode
node:SetLeftChild(leftNode)
if node:IsLeaf()
output "This node is a leaf."
else
output "This node is not a leaf."
end
SetBoundingBox(Libraries.Game.Collision.BoundingBox2D boundingBox)
This action sets the BoundingBox2D which this node is to represent. This action is used internally.
Parameters
- Libraries.Game.Collision.BoundingBox2D: The BoundingBox2D to be represented by this tree node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.BoundingBox2D
DynamicBoundingVolumeTreeNode2D node
BoundingBox2D boundingBox
node:SetBoundingBox(boundingBox)
SetHeight(integer height)
This action sets the height of the Dynamic Bounding Volume Tree Node (2D) in the DynamicBoundingVolumeTree2D. This action is used internally.
Parameters
- integer height: The integer height at which this node should be.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.Item2DNode
DynamicBoundingVolumeTreeNode2D node
Item2DNode itemNode
node:SetHeight(1)
SetID(integer id)
This action sets the id of the Dynamic Bounding Volume Tree Node (2D). This action is used internally.
Parameters
- integer id: The integer that will be the node id.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
node:Set(0)
SetItemNode(Libraries.Game.Collision.Item2DNode itemNode)
This action sets the Item2DNode of the Dynamic Bounding Volume Tree Node (2D), which has among its data members a BoundingBox2D and an Item2D. This action is used internally.
Parameters
- Libraries.Game.Collision.Item2DNode: The item2DNode that this node will represent.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
use Libraries.Game.Collision.Item2DNode
DynamicBoundingVolumeTreeNode2D node
Item2DNode itemNode
node:SetItemNode(itemNode)
SetLeftChild(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D leftChild)
This action sets the DynamicBoundingVolumeTreeNode2D which is to be the left child of this node. This action is used internally.
Parameters
- Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D: The DynamicBoundingVolumeTreeNode2D which is to be the left child of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D leftNode
node:SetLeftChild(leftNode)
SetParent(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D treeParent)
This action sets the DynamicBoundingVolumeTreeNode2D which is to be the parent of this node. This action is used internally.
Parameters
- Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D: The DynamicBoundingVolumeTreeNode2D which is to be the parent of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D parentNode
node:SetParent(parentNode)
SetRightChild(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D rightChild)
This action sets the DynamicBoundingVolumeTreeNode2D which is to be the right child of this node. This action is used internally.
Parameters
- Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D: The DynamicBoundingVolumeTreeNode2D which is to be the right child of this node.
Example
use Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D
DynamicBoundingVolumeTreeNode2D node
DynamicBoundingVolumeTreeNode2D rightNode
node:SetRightChild(rightNode)
On this page
Variables TableAction Documentation- Compare(Libraries.Language.Object object)
- Equals(Libraries.Language.Object object)
- GetBoundingBox()
- GetHashCode()
- GetHeight()
- GetID()
- GetItemNode()
- GetLeftChild()
- GetParent()
- GetRightChild()
- IsLeaf()
- SetBoundingBox(Libraries.Game.Collision.BoundingBox2D boundingBox)
- SetHeight(integer height)
- SetID(integer id)
- SetItemNode(Libraries.Game.Collision.Item2DNode itemNode)
- SetLeftChild(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D leftChild)
- SetParent(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D treeParent)
- SetRightChild(Libraries.Game.Collision.DynamicBoundingVolumeTreeNode2D rightChild)