KD-Tree traversal (raytracing) - am I missing a case? -


I am trying to cross a 3D KD-tree in my recorder. The tree is right, but there is something wrong with my traversal algorithm because I get some errors compared to a cruel force approach (some small surface areas are not taken care of).

Note: None of the rays in the question is parallel to any axis

This is my traversal algorithm:.

  IntersectionData * intersectKDTree (constant ray, kdTreeNode * node, double timin, double tmx) const {if (node-> GetObjectCount () == 0) returns; Intersection data * current = 0; Bull intersected = false; If (node-> m_isLeaf) {... test all the priorities in the leaf ...} and {int axis = node- & gt; M_splitAxis; Double Split Piece = Node-> M_splitPos; Double TSplit = (Split-Peace-Point [axis]) / Ray Direction [axis]; KDTNnode * PassNode = RAIPoint [Axis]  M_bनेलnode: node-> M_right anode; KDTreeNode * farNode = ray.point [axis] & lt; SplitPos? Node-> M_rightnode: node- & gt; M_leftnode; If (tSplit> Tmax) returned intersectKDTree (ray, nearNode, tmin, tmax); // case one else if (tSplit & lt; tMin) {if (tSplit> 0) intersectKDTree return (ray, farNode, tmin, tmax); // If any other case B // case C rest {// tSplit == 0 if (ray.direction [axis] <0) (tSplit & lt; 0) intersectKDTree (ray, nearNode, tmin, tmax) return Return intersectKDTree (ray, farNode, tmin, tmax); // Case D rest returned intersectKDTree (ray, nearNode, tmin, tmax); // case E}} else {if (tSplit> 0) {// case F current = intersectKDTree (ray, node, TMIN, TSplit); If (current! = 0) current return; And then return the interstate KDT (Ray, Telecom, TSplit, TMx); } Else {return intersectKDTree (ray, nearNode, tSplit, Tmax); // case g}}}}  

I created a graphic with all the different cases:

Do I have a case missing?

Thanks for the help!

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -