OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
compareObj.cpp
Go to the documentation of this file.
1 #include "compareObj.h"
2 #include <cstdio>
3 #include <L3Shape.h>
4 
5 #include <boost/geometry.hpp>
6 #include <boost/geometry/geometries/linestring.hpp>
7 
8 using namespace l3;
9 
10 CompareObjLonOnly::CompareObjLonOnly(double east, double west) {
11  this->east = constrainLon(east);
12  this->west = constrainLon(west);
13  if (this->east < this->west)
14  this->east += 360.0;
15 }
16 
17 bool CompareObjLonOnly::isInside(double lat, double lon) {
18  lon = constrainLon(lon);
19  if (lon < west)
20  lon += 360.0;
21  if (lon <= east)
22  return true;
23  return false;
24 }
25 
27  lat0 = lat;
28  lon0 = lon;
29  this->radius = radius;
30 }
31 
32 bool CompareObjCircle::isInside(double lat, double lon) {
33  double const earth_radius = 6371.229;
34 
35  using namespace boost::geometry;
36  typedef model::point<double, 2, cs::spherical_equatorial<degree> > P;
37  model::linestring<P> line;
38  line.push_back(P(lon0, lat0));
39  line.push_back(P(lon, lat));
40  double dist = length(line, strategy::distance::haversine<double>(earth_radius));
41  if (dist <= radius)
42  return true;
43  return false;
44 }
CompareObjLonOnly(double east, double west)
Definition: compareObj.cpp:10
virtual bool isInside(double lat, double lon)
Definition: compareObj.cpp:17
float * lat
double constrainLon(double lon)
Definition: L3Shape.cpp:26
virtual bool isInside(double lat, double lon)
Definition: compareObj.cpp:32
subroutine geometry
float * lon
CompareObjCircle(double lat, double lon, double radius)
Definition: compareObj.cpp:26
Definition: L3File.cpp:10
void radius(double A)
Definition: proj_report.c:132