cpu_voxel_raycaster icon indicating copy to clipboard operation
cpu_voxel_raycaster copied to clipboard

Bug in traversal of the rays along the axes.

Open binaryzebra opened this issue 8 years ago • 0 comments

When you traverse rays along x, y or z axis your algorithm behaves fully incorrectly. It could lead to missing triangles or voxels when rays are parallel to axes.

You can make a simple test with cube (0.0, 0.0, 0.0, 1.0, 1.0, 1.0) and try to traverse a ray to this cube with the following ray( position (0.49, 0.49, -1) , direction(0, 0, 2)) You will see that because of 0s in direction whole algorithm detect new node wrongly.

I've added if (FLOAT_EQUAL(rayDirection.x, 0.0f)) rayDirection.x = 0.0000001f; if (FLOAT_EQUAL(rayDirection.y, 0.0f)) rayDirection.y = 0.0000001f; if (FLOAT_EQUAL(rayDirection.z, 0.0f)) rayDirection.z = 0.0000001f;

this to avoid such bugs, but I do not like this solution.

binaryzebra avatar Sep 28 '16 08:09 binaryzebra