moved shadowcasting function to mathematics module