59   double latitudeRadians = 0.01745329 * latitude;
 
   60   double longitudeRadians = 0.01745329 * longitude;
 
   68   else if (sphType == 
GRS80)
 
   79   double Rn = a / (sqrt (1 - pow (e, 2) * pow (sin (latitudeRadians), 2))); 
 
   81   double x = (Rn + altitude) * cos (latitudeRadians) * cos (longitudeRadians);
 
   82   double y = (Rn + altitude) * cos (latitudeRadians) * sin (longitudeRadians);
 
   83   double z = ((1 - pow (e, 2)) * Rn + altitude) * sin (latitudeRadians);
 
   84   Vector cartesianCoordinates = Vector (x, y, z);
 
   85   return cartesianCoordinates;
 
   90                                                                double originLongitude, 
 
   93                                                                double maxDistFromOrigin,
 
   98   if (originLatitude >= 90)
 
  100       NS_LOG_WARN (
"origin latitude must be less than 90. setting to 89.999");
 
  101       originLatitude = 89.999;
 
  103   else if (originLatitude <= -90)
 
  105       NS_LOG_WARN (
"origin latitude must be greater than -90. setting to -89.999");
 
  106       originLatitude = -89.999;
 
  113       NS_LOG_WARN (
"maximum altitude must be greater than or equal to 0. setting to 0");
 
  117   double originLatitudeRadians = originLatitude * (M_PI / 180);
 
  118   double originLongitudeRadians = originLongitude * (M_PI / 180);
 
  119   double originColatitude = (M_PI / 2) - originLatitudeRadians;
 
  129   std::list<Vector> generatedPoints;
 
  130   for (
int i = 0; i < numPoints; i++)
 
  133       double d = uniRand->
GetValue (0, EARTH_RADIUS - EARTH_RADIUS * cos (a)); 
 
  135       double phi = uniRand->
GetValue (0, M_PI * 2); 
 
  137       double alpha = acos((EARTH_RADIUS - d) / EARTH_RADIUS); 
 
  141       double theta = M_PI / 2 - alpha; 
 
  144       double randPointLatitude = asin(sin(theta)*cos(originColatitude) + 
 
  145                                  cos(theta)*sin(originColatitude)*sin(phi)); 
 
  147       double intermedLong = asin((sin(randPointLatitude)*cos(originColatitude) - 
 
  148                             sin(theta)) / (cos(randPointLatitude)*sin(originColatitude))); 
 
  150       intermedLong = intermedLong + M_PI / 2; 
 
  154       if (phi > (M_PI / 2) && phi <= ((3 * M_PI) / 2))
 
  155       intermedLong = -intermedLong;
 
  158       double randPointLongitude = intermedLong + originLongitudeRadians; 
 
  161       double randAltitude = uniRand->
GetValue (0, maxAltitude);
 
  164                              (randPointLatitude * (180/M_PI), 
 
  165                               randPointLongitude * (180/M_PI),
 
  171       generatedPoints.push_back (pointPosition); 
 
  174   return generatedPoints;
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function. 
 
static const double EARTH_WGS84_ECCENTRICITY
Earth's first eccentricity as defined by WGS84. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
EarthSpheroidType
Spheroid model to use for earth: perfect sphere (SPHERE), Geodetic Reference System 1980 (GRS80)...
 
static const double EARTH_RADIUS
Earth's radius in meters if modeled as a perfect sphere. 
 
static std::list< Vector > RandCartesianPointsAroundGeographicPoint(double originLatitude, double originLongitude, double maxAltitude, int numPoints, double maxDistFromOrigin, Ptr< UniformRandomVariable > uniRand)
Generates uniformly distributed random points (in ECEF Cartesian coordinates) within a given altitude...
 
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN. 
 
static const double EARTH_SEMIMAJOR_AXIS
GRS80 and WGS84 sources. 
 
static Vector GeographicToCartesianCoordinates(double latitude, double longitude, double altitude, EarthSpheroidType sphType)
Converts earth geographic/geodetic coordinates (latitude and longitude in degrees) with a given altit...
 
static const double EARTH_GRS80_ECCENTRICITY
Earth's first eccentricity as defined by GRS80.