mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
26 lines
514 B
Ruby
26 lines
514 B
Ruby
class IMICFPS
|
|
# Gets included into AABBTree
|
|
module AABBTreeDebug
|
|
def inspect
|
|
@branches, @leaves = 0, 0
|
|
if @root
|
|
node = @root
|
|
|
|
debug_search(node.a)
|
|
debug_search(node.b)
|
|
end
|
|
|
|
puts "<#{self.class}:#{self.object_id}> has #{@branches} branches and #{@leaves} leaves"
|
|
end
|
|
|
|
def debug_search(node)
|
|
if node.leaf?
|
|
@leaves += 1
|
|
else
|
|
@branches += 1
|
|
debug_search(node.a)
|
|
debug_search(node.b)
|
|
end
|
|
end
|
|
end
|
|
end |