tag:blogger.com,1999:blog-2403477577476951601.post4596308873914995218..comments2023-06-10T07:14:24.269-07:00Comments on PlayTechs: Programming for fun: "Raytracing on a Grid" updatedJames McNeillhttp://www.blogger.com/profile/08901649215141005959noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-2403477577476951601.post-83230190735708240922010-01-11T01:37:41.041-08:002010-01-11T01:37:41.041-08:00Oh! I actually had one other improvement that I di...Oh! I actually had one other improvement that I did to the original code come to think of it.<br /><br />Instead of tracking the number of cells to traverse as an integer, I just exit when t > 1.0. In my case, I also had the ray collision routines return the t value of the intersection. That way I could short circuit the traversal when I knew that the ray was moving into a grid cell that was beyond where a collision was already found.Unknownhttps://www.blogger.com/profile/02600972358402137201noreply@blogger.comtag:blogger.com,1999:blog-2403477577476951601.post-2910070132887756112010-01-11T01:29:32.127-08:002010-01-11T01:29:32.127-08:00I used your article as a reference when implementi...I used your article as a reference when implementing the spatial hash traversal for the segment queries in Chipmunk. I had some code that detected the NaNs and dealt with them. I could swear those checks were in your original code...<br /><br />http://code.google.com/p/chipmunk-physics/source/browse/trunk/src/cpSpaceHash.c#498<br /><br />I actually had to fix the same issue, but for a different reason. I was detecting the NaNs afterwards and dealing with them, but GCC's -ffast-math flag disables software checks for infinite and NaN math. Most FPUs do fine with the infinite stuff (PPC, x86, and ARM FPUs) but don't implement NaN checks. Took a while to realize that it was an issue too because I my debugging target was compiled without -ffast-math so I never noticed in my trivial tests. Whoops.Unknownhttps://www.blogger.com/profile/02600972358402137201noreply@blogger.com