fortran implementation of intersections