This file is indexed.

/usr/include/simgear/math/SGGeoc.hxx is in libsimgear-dev 3.4.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
// Copyright (C) 2006  Mathias Froehlich - Mathias.Froehlich@web.de
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Library General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Library General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//

#ifndef SGGeoc_H
#define SGGeoc_H

#include <simgear/constants.h>
 
// #define SG_GEOC_NATIVE_DEGREE

/// Class representing a geocentric location
class SGGeoc {
public:
  /// Default constructor, initializes the instance to lat = lon = lat = 0
  SGGeoc(void);

  /// Factory from angular values in radians and radius in ft
  static SGGeoc fromRadFt(double lon, double lat, double radius);
  /// Factory from angular values in degrees and radius in ft
  static SGGeoc fromDegFt(double lon, double lat, double radius);
  /// Factory from angular values in radians and radius in m
  static SGGeoc fromRadM(double lon, double lat, double radius);
  /// Factory from angular values in degrees and radius in m
  static SGGeoc fromDegM(double lon, double lat, double radius);
  /// Factory to convert position from a cartesian position assumed to be
  /// in wgs84 measured in meters
  /// Note that this conversion is relatively expensive to compute
  static SGGeoc fromCart(const SGVec3<double>& cart);
  /// Factory to convert position from a geodetic position
  /// Note that this conversion is relatively expensive to compute
  static SGGeoc fromGeod(const SGGeod& geod);

  /// Return the geocentric longitude in radians
  double getLongitudeRad(void) const;
  /// Set the geocentric longitude from the argument given in radians
  void setLongitudeRad(double lon);

  /// Return the geocentric longitude in degrees
  double getLongitudeDeg(void) const;
  /// Set the geocentric longitude from the argument given in degrees
  void setLongitudeDeg(double lon);

  /// Return the geocentric latitude in radians
  double getLatitudeRad(void) const;
  /// Set the geocentric latitude from the argument given in radians
  void setLatitudeRad(double lat);

  /// Return the geocentric latitude in degrees
  double getLatitudeDeg(void) const;
  /// Set the geocentric latitude from the argument given in degrees
  void setLatitudeDeg(double lat);

  /// Return the geocentric radius in meters
  double getRadiusM(void) const;
  /// Set the geocentric radius from the argument given in meters
  void setRadiusM(double radius);

  /// Return the geocentric radius in feet
  double getRadiusFt(void) const;
  /// Set the geocentric radius from the argument given in feet
  void setRadiusFt(double radius);

  SGGeoc advanceRadM(double course, double distance) const;
  static double courseRad(const SGGeoc& from, const SGGeoc& to);
  static double courseDeg(const SGGeoc& from, const SGGeoc& to);
  static double distanceM(const SGGeoc& from, const SGGeoc& to);

  // Compare two geocentric positions for equality
  bool operator == ( const SGGeoc & other ) const;
private:
  /// This one is private since construction is not unique if you do
  /// not know the units of the arguments, use the factory methods for
  /// that purpose
  SGGeoc(double lon, double lat, double radius);

  /// The actual data, angles in degree, radius in meters
  /// The rationale for storing the values in degrees is that most code places
  /// in flightgear/terragear use degrees as a nativ input and output value.
  /// The places where it makes sense to use radians is when we convert
  /// to other representations or compute rotation matrices. But both tasks
  /// are computionally intensive anyway and that additional 'toRadian'
  /// conversion does not hurt too much
  double _lon;
  double _lat;
  double _radius;
};

inline
SGGeoc::SGGeoc(void) :
  _lon(0), _lat(0), _radius(0)
{
}

inline
SGGeoc::SGGeoc(double lon, double lat, double radius) :
  _lon(lon), _lat(lat), _radius(radius)
{
}

inline
SGGeoc
SGGeoc::fromRadFt(double lon, double lat, double radius)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return SGGeoc(lon*SGD_RADIANS_TO_DEGREES, lat*SGD_RADIANS_TO_DEGREES,
                radius*SG_FEET_TO_METER);
#else
  return SGGeoc(lon, lat, radius*SG_FEET_TO_METER);
#endif
}

inline
SGGeoc
SGGeoc::fromDegFt(double lon, double lat, double radius)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return SGGeoc(lon, lat, radius*SG_FEET_TO_METER);
#else
  return SGGeoc(lon*SGD_DEGREES_TO_RADIANS, lat*SGD_DEGREES_TO_RADIANS,
                radius*SG_FEET_TO_METER);
#endif
}

inline
SGGeoc
SGGeoc::fromRadM(double lon, double lat, double radius)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return SGGeoc(lon*SGD_RADIANS_TO_DEGREES, lat*SGD_RADIANS_TO_DEGREES,
                radius);
#else
  return SGGeoc(lon, lat, radius);
#endif
}

inline
SGGeoc
SGGeoc::fromDegM(double lon, double lat, double radius)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return SGGeoc(lon, lat, radius);
#else
  return SGGeoc(lon*SGD_DEGREES_TO_RADIANS, lat*SGD_DEGREES_TO_RADIANS,
                radius);
#endif
}

inline
SGGeoc
SGGeoc::fromCart(const SGVec3<double>& cart)
{
  SGGeoc geoc;
  SGGeodesy::SGCartToGeoc(cart, geoc);
  return geoc;
}

inline
SGGeoc
SGGeoc::fromGeod(const SGGeod& geod)
{
  SGVec3<double> cart;
  SGGeodesy::SGGeodToCart(geod, cart);
  SGGeoc geoc;
  SGGeodesy::SGCartToGeoc(cart, geoc);
  return geoc;
}

inline
double
SGGeoc::getLongitudeRad(void) const
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return _lon*SGD_DEGREES_TO_RADIANS;
#else
  return _lon;
#endif
}

inline
void
SGGeoc::setLongitudeRad(double lon)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  _lon = lon*SGD_RADIANS_TO_DEGREES;
#else
  _lon = lon;
#endif
}

inline
double
SGGeoc::getLongitudeDeg(void) const
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return _lon;
#else
  return _lon*SGD_RADIANS_TO_DEGREES;
#endif
}

inline
void
SGGeoc::setLongitudeDeg(double lon)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  _lon = lon;
#else
  _lon = lon*SGD_DEGREES_TO_RADIANS;
#endif
}

inline
double
SGGeoc::getLatitudeRad(void) const
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return _lat*SGD_DEGREES_TO_RADIANS;
#else
  return _lat;
#endif
}

inline
void
SGGeoc::setLatitudeRad(double lat)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  _lat = lat*SGD_RADIANS_TO_DEGREES;
#else
  _lat = lat;
#endif
}

inline
double
SGGeoc::getLatitudeDeg(void) const
{
#ifdef SG_GEOC_NATIVE_DEGREE
  return _lat;
#else
  return _lat*SGD_RADIANS_TO_DEGREES;
#endif
}

inline
void
SGGeoc::setLatitudeDeg(double lat)
{
#ifdef SG_GEOC_NATIVE_DEGREE
  _lat = lat;
#else
  _lat = lat*SGD_DEGREES_TO_RADIANS;
#endif
}

inline
double
SGGeoc::getRadiusM(void) const
{
  return _radius;
}

inline
void
SGGeoc::setRadiusM(double radius)
{
  _radius = radius;
}

inline
double
SGGeoc::getRadiusFt(void) const
{
  return _radius*SG_METER_TO_FEET;
}

inline
void
SGGeoc::setRadiusFt(double radius)
{
  _radius = radius*SG_FEET_TO_METER;
}

inline
SGGeoc
SGGeoc::advanceRadM(double course, double distance) const
{
  SGGeoc result;
  SGGeodesy::advanceRadM(*this, course, distance, result);
  return result;
}

inline
double
SGGeoc::courseRad(const SGGeoc& from, const SGGeoc& to)
{
  return SGGeodesy::courseRad(from, to);
}

inline
double
SGGeoc::courseDeg(const SGGeoc& from, const SGGeoc& to)
{
  return SGMiscd::rad2deg(courseRad(from, to));
}

inline
double
SGGeoc::distanceM(const SGGeoc& from, const SGGeoc& to)
{
  return SGGeodesy::distanceM(from, to);
}

inline
bool
SGGeoc::operator == ( const SGGeoc & other ) const
{
  return _lon == other._lon &&
         _lat == other._lat &&
         _radius == other._radius;
}

/// Output to an ostream
template<typename char_type, typename traits_type>
inline
std::basic_ostream<char_type, traits_type>&
operator<<(std::basic_ostream<char_type, traits_type>& s, const SGGeoc& g)
{
  return s << "lon = " << g.getLongitudeDeg()
           << ", lat = " << g.getLatitudeDeg()
           << ", radius = " << g.getRadiusM();
}

#endif