Computing the gravitational and magnetic anomalies due to a polygon; algorithms and Fortran subroutines | Synapse