Mesh Oriented datABase  (version 5.6.0)
An array-based unstructured mesh library
moab::anonymous_namespace{NCWriteScrip.cpp} Namespace Reference

Functions

void xyz_to_latlon_deg (double x, double y, double z, double &lat, double &lon)
 Convert Cartesian XYZ (on or near the unit sphere) to lat/lon in degrees. Normalizes internally so callers don't have to. Longitude is shifted to [0, 360). More...
 

Variables

constexpr double kPi = 3.14159265358979323846
 
constexpr double kRadToDegree = 180.0 / kPi
 

Function Documentation

◆ xyz_to_latlon_deg()

void moab::anonymous_namespace{NCWriteScrip.cpp}::xyz_to_latlon_deg ( double  x,
double  y,
double  z,
double &  lat,
double &  lon 
)
inline

Convert Cartesian XYZ (on or near the unit sphere) to lat/lon in degrees. Normalizes internally so callers don't have to. Longitude is shifted to [0, 360).

Definition at line 31 of file NCWriteScrip.cpp.

32 {
33  const double r = std::sqrt( x * x + y * y + z * z );
34  if( r < 1.0e-30 )
35  {
36  lat = 0.0;
37  lon = 0.0;
38  return;
39  }
40  lat = std::asin( z / r ) * kRadToDegree;
41  lon = std::atan2( y, x ) * kRadToDegree;
42  if( lon < 0.0 ) lon += 360.0;
43 }

References kRadToDegree.

Referenced by moab::NCWriteScrip::collect_mesh_info().

Variable Documentation

◆ kPi

constexpr double moab::anonymous_namespace{NCWriteScrip.cpp}::kPi = 3.14159265358979323846
constexpr

Definition at line 25 of file NCWriteScrip.cpp.

◆ kRadToDegree

constexpr double moab::anonymous_namespace{NCWriteScrip.cpp}::kRadToDegree = 180.0 / kPi
constexpr

Definition at line 26 of file NCWriteScrip.cpp.

Referenced by xyz_to_latlon_deg().