The code which was checking whether local intersection is to be recorded, and under which index was duplicated for triangles, motion triangles, and HIP-RT triangle filter function. This change moves the common logic to an utility function which is reused from all the places mentioned above. Pull Request: https://projects.blender.org/blender/blender/pulls/136244