SFF++ library: reading and writing SFF from C++

◆ sourcedistance()

double sff::sourcedistance ( const SRCE srce,
const INFO info 
)

return spatial distance between source and receiver in meters

Definition at line 78 of file offset.cc.

References sff::SRCE::cs, sff::INFO::cs, CS_cartesian, sff::SRCE::cx, sff::INFO::cx, sff::SRCE::cy, sff::INFO::cy, sff::SRCE::cz, sff::INFO::cz, SFF_abort, and SFF_assert.

79  {
80  double retval;
81  SFF_assert((srce.cs == info.cs),
82  "ERROR (sourcedistance): inconsistent coordinate systems!");
83  SFF_assert((srce.cs == CS_cartesian),
84  "ERROR (sourcedistance): "
85  "only provided in Cartesian coordinates!");
86  if (srce.cs == CS_cartesian)
87  {
88  double dx=srce.cx-info.cx;
89  double dy=srce.cy-info.cy;
90  double dz=srce.cz-info.cz;
91  retval=sqrt(dx*dx+dy*dy+dz*dz);
92  }
93  else
94  {
95  SFF_abort("ERROR (sourcedistance): unknown coordinate system!");
96  }
97  return(retval);
98  } // double sourcedistance(const SRCE& srce, const INFO& info)
#define SFF_assert(C, M)
check condition
Definition: sffxx.h:82
#define SFF_abort(M)
abort by throwing an exception
Definition: sffxx.h:91