Converted CoordGeodetic to struct
parent
6f3e72c902
commit
989999ea45
|
@ -2,17 +2,17 @@
|
|||
|
||||
CoordGeodetic::CoordGeodetic(const CoordGeodetic& b) {
|
||||
|
||||
lat_ = b.lat_;
|
||||
lon_ = b.lon_;
|
||||
alt_ = b.alt_;
|
||||
latitude = b.latitude;
|
||||
longitude = b.longitude;
|
||||
altitude = b.altitude;
|
||||
}
|
||||
|
||||
CoordGeodetic& CoordGeodetic::operator =(const CoordGeodetic& b) {
|
||||
|
||||
if (this != &b) {
|
||||
lat_ = b.lat_;
|
||||
lon_ = b.lon_;
|
||||
alt_ = b.alt_;
|
||||
latitude = b.latitude;
|
||||
longitude = b.longitude;
|
||||
altitude = b.altitude;
|
||||
}
|
||||
|
||||
return (*this);
|
||||
|
@ -20,9 +20,9 @@ CoordGeodetic& CoordGeodetic::operator =(const CoordGeodetic& b) {
|
|||
|
||||
bool CoordGeodetic::operator ==(const CoordGeodetic& b) const {
|
||||
|
||||
if (lat_ == b.lat_ &&
|
||||
lon_ == b.lon_ &&
|
||||
alt_ == b.alt_) {
|
||||
if (latitude == b.latitude &&
|
||||
longitude == b.longitude &&
|
||||
altitude == b.altitude) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -31,9 +31,9 @@ bool CoordGeodetic::operator ==(const CoordGeodetic& b) const {
|
|||
|
||||
bool CoordGeodetic::operator !=(const CoordGeodetic& b) const {
|
||||
|
||||
if (lat_ == b.lat_ &&
|
||||
lon_ == b.lon_ &&
|
||||
alt_ == b.alt_) {
|
||||
if (latitude == b.latitude &&
|
||||
longitude == b.longitude &&
|
||||
altitude == b.altitude) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#ifndef COORDGEODETIC_H_
|
||||
#define COORDGEODETIC_H_
|
||||
|
||||
class CoordGeodetic {
|
||||
struct CoordGeodetic {
|
||||
public:
|
||||
|
||||
CoordGeodetic()
|
||||
: lat_(0.0), lon_(0.0), alt_(0.0) {
|
||||
: latitude(0.0), longitude(0.0), altitude(0.0) {
|
||||
}
|
||||
|
||||
/*
|
||||
* radians
|
||||
*/
|
||||
CoordGeodetic(double latitude, double longitude, double altitude)
|
||||
: lat_(latitude), lon_(longitude), alt_(altitude) {
|
||||
CoordGeodetic(double lat, double lon, double alt)
|
||||
: latitude(lat), longitude(lon), altitude(alt) {
|
||||
}
|
||||
|
||||
CoordGeodetic(const CoordGeodetic& g);
|
||||
|
@ -23,44 +23,19 @@ public:
|
|||
CoordGeodetic & operator =(const CoordGeodetic& b);
|
||||
bool operator ==(const CoordGeodetic& b) const;
|
||||
bool operator !=(const CoordGeodetic& b) const;
|
||||
|
||||
void SetLatitude(const double latitude) {
|
||||
lat_ = latitude;
|
||||
}
|
||||
|
||||
void SetLongitude(const double longitude) {
|
||||
lon_ = longitude;
|
||||
}
|
||||
|
||||
void SetAltitude(const double altitude) {
|
||||
alt_ = altitude;
|
||||
}
|
||||
|
||||
double GetLatitude() const {
|
||||
return lat_;
|
||||
}
|
||||
|
||||
double GetLongitude() const {
|
||||
return lon_;
|
||||
}
|
||||
|
||||
double GetAltitude() const {
|
||||
return alt_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/*
|
||||
* radians (north positive, south negative)
|
||||
*/
|
||||
double lat_;
|
||||
double latitude;
|
||||
/*
|
||||
* radians (east positive, west negative)
|
||||
*/
|
||||
double lon_;
|
||||
double longitude;
|
||||
/*
|
||||
* kilometers
|
||||
*/
|
||||
double alt_;
|
||||
double altitude;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
6
Eci.cpp
6
Eci.cpp
|
@ -4,9 +4,9 @@ Eci::Eci(const Julian &date, const CoordGeodetic &geo)
|
|||
: date_(date) {
|
||||
|
||||
static const double mfactor = kTWOPI * (kOMEGA_E / kSECONDS_PER_DAY);
|
||||
const double latitude = geo.GetLatitude();
|
||||
const double longitude = geo.GetLongitude();
|
||||
const double altitude = geo.GetAltitude();
|
||||
const double latitude = geo.latitude;
|
||||
const double longitude = geo.longitude;
|
||||
const double altitude = geo.altitude;
|
||||
|
||||
/*
|
||||
* Calculate Local Mean Sidereal Time for observers longitude
|
||||
|
|
12
Observer.cpp
12
Observer.cpp
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
Observer::Observer(const double latitude, const double longitude, const double altitude) {
|
||||
|
||||
geo_.SetLatitude(DegreesToRadians(latitude));
|
||||
geo_.SetLongitude(DegreesToRadians(longitude));
|
||||
geo_.SetAltitude(altitude);
|
||||
geo_.latitude = DegreesToRadians(latitude);
|
||||
geo_.longitude = DegreesToRadians(longitude);
|
||||
geo_.altitude = altitude;
|
||||
|
||||
UpdateObserversEci(Julian());
|
||||
}
|
||||
|
@ -51,10 +51,10 @@ CoordTopographic Observer::GetLookAngle(const Eci &eci) {
|
|||
/*
|
||||
* Calculate Local Mean Sidereal Time for observers longitude
|
||||
*/
|
||||
double theta = eci.GetDate().ToLocalMeanSiderealTime(geo_.GetLongitude());
|
||||
double theta = eci.GetDate().ToLocalMeanSiderealTime(geo_.longitude);
|
||||
|
||||
double sin_lat = sin(geo_.GetLatitude());
|
||||
double cos_lat = cos(geo_.GetLatitude());
|
||||
double sin_lat = sin(geo_.latitude);
|
||||
double cos_lat = cos(geo_.latitude);
|
||||
double sin_theta = sin(theta);
|
||||
double cos_theta = cos(theta);
|
||||
|
||||
|
|
Loading…
Reference in New Issue