Class: BulldogPhysics::QuadTreeNode
- Inherits:
-
Object
- Object
- BulldogPhysics::QuadTreeNode
- Defined in:
- lib/RigidBodies/rigid_collisions.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#position ⇒ Object
Returns the value of attribute position.
Instance Method Summary collapse
- #get_child_index(object_centre) ⇒ Object
-
#initialize ⇒ QuadTreeNode
constructor
A new instance of QuadTreeNode.
Constructor Details
#initialize ⇒ QuadTreeNode
Returns a new instance of QuadTreeNode.
123 124 125 126 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 123 def initialize() @position = Vector3.new @children = Array.new(4, QuadTreeNode.new) end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
121 122 123 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 121 def children @children end |
#position ⇒ Object
Returns the value of attribute position.
121 122 123 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 121 def position @position end |
Instance Method Details
#get_child_index(object_centre) ⇒ Object
128 129 130 131 132 133 |
# File 'lib/RigidBodies/rigid_collisions.rb', line 128 def get_child_index(object_centre) index = 0 index += 1 if object_centre.x > @position.x index += 2 if object_centre.z > @position.z index end |