[mareframe] Annotation of /trunk/gadget/rectangle.cc
Annotation of /trunk/gadget/rectangle.cc
Parent Directory
| Revision Log
Revision 1 -
(view)
(download)
1 : |
agomez |
1 |
#include "rectangle.h" |
2 : |
|
|
#include "mathfunc.h" |
3 : |
|
|
|
4 : |
|
|
Rectangle::Rectangle() {
|
5 : |
|
|
xLower = yLower = xUpper = yUpper = 0.0;
|
6 : |
|
|
areaSize = 0.0;
|
7 : |
|
|
}
|
8 : |
|
|
|
9 : |
|
|
//JMB - we need to do some checks here ...
|
10 : |
|
|
//should we convert these into something? km?
|
11 : |
|
|
Rectangle::Rectangle(CommentStream& infile) {
|
12 : |
|
|
infile >> yLower >> xLower >> yUpper >> xUpper >> ws;
|
13 : |
|
|
// infile >> xLower >> yLower >> xUpper >> yUpper >> ws;
|
14 : |
|
|
|
15 : |
|
|
double R = 6371.0;
|
16 : |
|
|
double yLowerSin = sin(yLower*pivalue/180.0);
|
17 : |
|
|
double yUpperSin = sin(yUpper*pivalue/180.0);
|
18 : |
|
|
areaSize = ((pivalue/180.0)*R*R)*fabs(yLowerSin - yUpperSin)*fabs(xLower - xUpper);
|
19 : |
|
|
}
|
20 : |
|
|
|
21 : |
|
|
/*
|
22 : |
|
|
Equatorial radius (km) 6378.1
|
23 : |
|
|
Polar radius (km) 6356.8
|
24 : |
|
|
Volumetric mean radius (km) 6371.0
|
25 : |
|
|
Core radius (km) 3485
|
26 : |
|
|
= 2*pi*R^2 |sin(lat1)-sin(lat2)| |lon1-lon2|/360
|
27 : |
|
|
= (pi/180)R^2 |sin(lat1)-sin(lat2)| |lon1-lon2|
|
28 : |
|
|
*/
|
|