Currently the result is depending on the mesh structures. Meshes can be build diffrently. In our case we used the vol2mesh method from http://iso2mesh.sourceforge.net/cgi-bin/index.cgi to create the meshes. The result has two layers between region transitions, which means two triangles on the exact same positions. That is show in the picture with the red and inner black lines, which representing each a diffrent region. Then the ray always travels in and out of an material before it reachs the next on or an detector.
<br>
In other words, the current algorithm always expects to leave a region after entering it and before entering the next one. As you can see that has effects on the number of hits. Normally we would expect 4 hit because of 2 diffrent regions. But with these double layers we get 6 hits. This is a property the mesh needs for correct calculation.<br>
Normaly this double layer exists also for the outer layer but there it has not even the same positions but the same region. With _unique(faces,'rows')_ in Matlab before calling the raytracing kernel these outer layer can be deleted.