#2 incorrect partitioning of triangles when building octrees

open
nobody
None
5
2009-03-11
2009-03-11
Siege
No

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);
var
m : Integer;
begin
if triBoxOverlap(Onode^.MinExtent, Onode^.MaxExtent, v1, v2, v3) then begin
if Onode^.ChildArray[0] <> NIL then
for m:=0 to 7 do
WalkTriToLeafx(Onode^.ChildArray[m], v1, v2, v3)
else begin
SetLength(resultarray, Length(resultarray)+1);
resultarray[High(resultarray)]:=Onode;
end;
end;
end;

The triBoxOverlap function is contained in the attached file.

Discussion

  • Siege
    Siege
    2009-03-11

    conatins triBoxOverlap function

     
    Attachments