/usr/include/ossim/base/ossimEcefVector.h is in libossim-dev 1.8.16-4ubuntu1.
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 | //*****************************************************************************
// FILE: ossimEcefVector.h
//
// License: See top level LICENSE.txt file.
//
// DESCRIPTION:
// Contains declaration of a 3D vector object in the Earth-centered, earth
// fixed (ECEF) coordinate system.
//
// NOTE: There is no associated ossimEcefVector.cc file. All methods are
// inlined here
//
// SOFTWARE HISTORY:
//>
// 08Aug2001 Oscar Kramer
// Initial coding.
//<
//*****************************************************************************
// $Id: ossimEcefVector.h 20043 2011-09-06 15:00:55Z oscarkramer $
#ifndef ossimEcefVector_HEADER
#define ossimEcefVector_HEADER
#include <cmath>
#include <ossim/base/ossimCommon.h>
#include <ossim/base/ossimColumnVector3d.h>
#include <ossim/base/ossimEcefPoint.h>
#include <ossim/base/ossimString.h>
#include <ossim/matrix/newmat.h>
class ossimGpt;
//*****************************************************************************
// CLASS: ossimEcefVector
//
//*****************************************************************************
class OSSIMDLLEXPORT ossimEcefVector
{
public:
/*!
* CONSTRUCTORS:
*/
ossimEcefVector()
: theData(0,0,0) {}
ossimEcefVector(const ossimEcefVector& copy_this)
: theData (copy_this.theData) {}
ossimEcefVector(const NEWMAT::ColumnVector& assign_this)
: theData (assign_this) {}
ossimEcefVector(const ossimEcefPoint& from,
const ossimEcefPoint& to)
: theData (to.data() - from.data()) {}
ossimEcefVector(const ossimGpt& from,
const ossimGpt& to)
: theData ((ossimEcefPoint(to) - ossimEcefPoint(from)).data()) {}
ossimEcefVector(const double& x,
const double& y,
const double& z)
: theData(x, y, z) {}
ossimEcefVector(const ossimColumnVector3d& assign_this)
: theData(assign_this) {}
void makeNan()
{
theData[0] = ossim::nan();
theData[1] = ossim::nan();
theData[2] = ossim::nan();
}
bool hasNans()const
{
return ( ossim::isnan(theData[0]) ||
ossim::isnan(theData[1]) ||
ossim::isnan(theData[2]) );
}
bool isNan()const
{
return ( ossim::isnan(theData[0]) &&
ossim::isnan(theData[1]) &&
ossim::isnan(theData[2]) );
}
/*!
* OPERATORS: (all inlined below)
*/
inline ossimEcefVector operator- () const;
inline ossimEcefVector operator+ (const ossimEcefVector&) const;
inline ossimEcefVector operator- (const ossimEcefVector&) const;
inline ossimEcefPoint operator+ (const ossimEcefPoint&) const;
inline ossimEcefVector operator* (const double&) const;
inline ossimEcefVector operator/ (const double&) const;
inline bool operator==(const ossimEcefVector&) const;
inline bool operator!=(const ossimEcefVector&) const;
inline const ossimEcefVector& operator= (const ossimEcefVector&);
/*!
* Vector-related functions: (all inlined below)
*/
inline double dot (const ossimEcefVector&) const;
inline double angleTo(const ossimEcefVector&) const; // degrees
inline ossimEcefVector cross (const ossimEcefVector&) const;
inline ossimEcefVector unitVector() const;
inline double magnitude() const; // meters
inline double norm2() const; // squared meters
inline double length() const;
inline double normalize();
/*!
* COMPONENT ACCESS METHODS:
*/
double x() const { return theData[0]; }
double& x() { return theData[0]; }
double y() const { return theData[1]; }
double& y() { return theData[1]; }
double z() const { return theData[2]; }
double& z() { return theData[2]; }
double& operator [](int idx){return theData[idx];}
const double& operator [](int idx)const{return theData[idx];}
const ossimColumnVector3d& data() const { return theData; }
ossimColumnVector3d& data() { return theData; }
/**
* @brief To string method.
*
* @param precision Output floating point precision.
*
* @return ossimString representing point.
*
* Output format:
* ( 0.0000000, 0.0000000, 0.00000000 )
* -----x---- -----y---- ------z----
*/
ossimString toString(ossim_uint32 precision=15) const;
/**
* @brief Initializes this point from string.
*
* Expected format:
*
* ( 0.0000000, 0.0000000, 0.00000000 )
* -----x---- -----y---- ------z----
*
* @param s String to initialize from.
*/
void toPoint(const std::string& s);
//! Converts this point to a 3D column vector.
NEWMAT::ColumnVector toVector() const
{
NEWMAT::ColumnVector v (3);
v(0) = theData[0];
v(1) = theData[1];
v(2) = theData[2];
return v;
}
/*!
* Debug Dump:
*/
void print(ostream& os = ossimNotify(ossimNotifyLevel_INFO)) const
{ os << "(ossimEcefVector) " << theData; }
friend ostream& operator<< (ostream& os , const ossimEcefVector& instance)
{ instance.print(os); return os; }
protected:
ossimColumnVector3d theData;
};
//================== BEGIN DEFINITIONS FOR INLINE METHODS =====================
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator-()
// Reverses direction of vector.
//*****************************************************************************
inline ossimEcefVector ossimEcefVector::operator-() const
{
return ossimEcefVector(-theData);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator+(const ossimEcefVector&)
//*****************************************************************************
inline ossimEcefVector
ossimEcefVector::operator+(const ossimEcefVector& v) const
{
return ossimEcefVector(theData + v.theData);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator-(const ossimEcefVector&)
//*****************************************************************************
inline ossimEcefVector
ossimEcefVector::operator-(const ossimEcefVector& v) const
{
return ossimEcefVector(theData - v.theData);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator+(const ossimEcefPoint&)
//*****************************************************************************
inline ossimEcefPoint
ossimEcefVector::operator+(const ossimEcefPoint& p) const
{
return ossimEcefPoint(theData + p.data());
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator*(const double&)
//*****************************************************************************
inline ossimEcefVector ossimEcefVector::operator*(const double& scalar) const
{
return ossimEcefVector(theData*scalar);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator/(const double&)
//*****************************************************************************
inline ossimEcefVector ossimEcefVector::operator/(const double& scalar) const
{
return ossimEcefVector(theData/scalar);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator==(const ossimEcefVector&)
//*****************************************************************************
inline bool ossimEcefVector::operator==(const ossimEcefVector& v) const
{
return (theData == v.theData);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator!=(const ossimEcefVector&)
//*****************************************************************************
inline bool ossimEcefVector::operator!=(const ossimEcefVector& v) const
{
return (theData != v.theData);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::operator=
//*****************************************************************************
inline const ossimEcefVector&
ossimEcefVector::operator=(const ossimEcefVector& v)
{
theData = v.theData;
return *this;
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::dot()
// Computes the scalar product.
//*****************************************************************************
inline double ossimEcefVector::dot(const ossimEcefVector& v) const
{
return theData.dot(v.theData);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::angleTo()
// Returns the angle subtended (in DEGREES) between this and arg vector
//*****************************************************************************
inline double ossimEcefVector::angleTo(const ossimEcefVector& v) const
{
double mag_product = theData.magnitude() * v.theData.magnitude();
return ossim::acosd(theData.dot(v.theData)/mag_product);
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::cross()
// Computes the cross product.
//*****************************************************************************
inline ossimEcefVector ossimEcefVector::cross(const ossimEcefVector& v) const
{
return ossimEcefVector(theData.cross(v.theData));
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::unitVector()
// Returns a unit vector parallel to this.
//*****************************************************************************
inline ossimEcefVector ossimEcefVector::unitVector() const
{
return ossimEcefVector(theData/theData.magnitude());
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::magnitude()
//*****************************************************************************
inline double ossimEcefVector::magnitude() const
{
return theData.magnitude();
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::norm2()
//*****************************************************************************
inline double ossimEcefVector::norm2() const
{
return theData.norm2();
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::length()
//*****************************************************************************
inline double ossimEcefVector::length() const
{
return theData.magnitude();
}
//*****************************************************************************
// INLINE METHOD: ossimEcefVector::normalize()
// Normalizes this vector.
//*****************************************************************************
inline double ossimEcefVector::normalize()
{
double result = theData.magnitude();
if(result > 1e-15)
{
theData /= result;
}
return result;
}
#endif
|