Code: Select all

` while (n.parent != null) {`

// check if the current node the left child of its parent

if (n == n.parent.left) {

// it is, so check if the right node is non-null

if (n.parent.right != null) {

// it isn't so the sibling node is the next node

n = n.parent.right;

nextNodeFound = true;

break;

}

}

// if the current node isn't a left node or it is but its

// sibling is null, go to the parent node

n = n.parent;

}

it seems that a node which has a child ( if (n == n.parent.left) ) might have not sibling(if (n.parent.right != null) ).

How it is possible in AABB Tree ?

// if the current node isn't a left node or it is but its

// sibling is null,

so far as i know, it is in conflict with the insertion strategy and AABB tree must be complete tree, each non-leaf node must have two child. can someone make it clear ?

thanks