I have noticed that octree nodes in some cases reference triangles that are not contained in or intersected by those nodes. I have isolated this problem to TOctree.WalkTriToLeafx. It seems that intersection test between a triangle and a box is incomplete.
I suggest using this function instead:
procedure TOctree.WalkTriToLeafx(Onode: POctreeNode; const v1, v2, v3: TAffineFLTVector);
m : Integer;
if triBoxOverlap(Onode^.MinExtent, Onode^.MaxExtent, v1, v2, v3) then begin
if Onode^.ChildArray <> NIL then
for m:=0 to 7 do
WalkTriToLeafx(Onode^.ChildArray[m], v1, v2, v3)
The triBoxOverlap function is contained in the attached file.