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