~ubuntu-branches/ubuntu/oneiric/flightgear/oneiric

« back to all changes in this revision

Viewing changes to src/ATC/ATCProjection.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2006-01-05 12:48:11 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060105124811-xsr6rtcrb88w19c8
Tags: 0.9.9-1ubuntu1
Resynchronise with Debian.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
    correction_factor = cos(origin.lat() * DCL_DEGREES_TO_RADIANS);
38
38
}
39
39
 
 
40
FGATCProjection::FGATCProjection(const Point3D& centre) {
 
41
    origin = centre;
 
42
    correction_factor = cos(origin.lat() * DCL_DEGREES_TO_RADIANS);
 
43
}
 
44
 
40
45
FGATCProjection::~FGATCProjection() {
41
46
}
42
47
 
43
 
void FGATCProjection::Init(Point3D centre) {
 
48
void FGATCProjection::Init(const Point3D& centre) {
44
49
    origin = centre;
45
50
    correction_factor = cos(origin.lat() * DCL_DEGREES_TO_RADIANS);
46
51
}
47
52
 
48
 
Point3D FGATCProjection::ConvertToLocal(Point3D pt) {
 
53
Point3D FGATCProjection::ConvertToLocal(const Point3D& pt) {
49
54
    double delta_lat = pt.lat() - origin.lat();
50
55
    double delta_lon = pt.lon() - origin.lon();
51
56
 
55
60
    return(Point3D(x,y,0.0));
56
61
}
57
62
 
58
 
Point3D FGATCProjection::ConvertFromLocal(Point3D pt) {
 
63
Point3D FGATCProjection::ConvertFromLocal(const Point3D& pt) {
59
64
        double delta_lat = asin(pt.y() / SG_EQUATORIAL_RADIUS_M) * DCL_RADIANS_TO_DEGREES;
60
65
        double delta_lon = (asin(pt.x() / SG_EQUATORIAL_RADIUS_M) * DCL_RADIANS_TO_DEGREES) / correction_factor;
61
66
        
74
79
FGATCAlignedProjection::~FGATCAlignedProjection() {
75
80
}
76
81
 
77
 
void FGATCAlignedProjection::Init(Point3D centre, double heading) {
 
82
void FGATCAlignedProjection::Init(const Point3D& centre, double heading) {
78
83
    origin = centre;
79
84
    theta = heading * DCL_DEGREES_TO_RADIANS;
80
85
    correction_factor = cos(origin.lat() * DCL_DEGREES_TO_RADIANS);
81
86
}
82
87
 
83
 
Point3D FGATCAlignedProjection::ConvertToLocal(Point3D pt) {
 
88
Point3D FGATCAlignedProjection::ConvertToLocal(const Point3D& pt) {
84
89
    // convert from lat/lon to orthogonal
85
90
    double delta_lat = pt.lat() - origin.lat();
86
91
    double delta_lon = pt.lon() - origin.lon();
95
100
    return(Point3D(x,y,pt.elev()));
96
101
}
97
102
 
98
 
Point3D FGATCAlignedProjection::ConvertFromLocal(Point3D pt) {
 
103
Point3D FGATCAlignedProjection::ConvertFromLocal(const Point3D& pt) {
99
104
        //cout << "theta = " << theta << '\n';
100
105
        //cout << "origin = " << origin << '\n';
101
106
    // de-align