/usr/include/ossim/base/ossimDpt3d.h is in libossim-dev 2.2.2-1.
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 | //*******************************************************************
//
// License: MIT
//
// See LICENSE.txt file in the top level directory for more details.
//
// Author: Garrett Potts
//
// Description:
//
// Contains class declaration for dpt3d
// Used to represent a 3d double point containing an x, y and z data member.
//*******************************************************************
// $Id: ossimDpt3d.h 22937 2014-11-01 11:30:13Z okramer $
#ifndef ossimDpt3d_HEADER
#define ossimDpt3d_HEADER
#include <cmath>
#include <iosfwd>
#include <string>
#include <ossim/base/ossimCommon.h> /* for ossim::isnan */
#include <ossim/base/ossimColumnVector3d.h>
class ossimIpt;
class ossimDpt;
class OSSIMDLLEXPORT ossimDpt3d
{
public:
friend OSSIMDLLEXPORT std::ostream & operator <<(std::ostream &out,
const ossimDpt3d &rhs);
ossimDpt3d(const double &aX=0, const double &aY=0, const double &aZ=0)
:x(aX), y(aY), z(aZ) {}
ossimDpt3d(const ossimDpt &aPt);
ossimDpt3d(const ossimIpt &aPt);
//! Argument gPt is converted to WGS84 datum before coordinates are stored in x, y, z.
//! Likewise, ossimGpt has a constructor that accepts an ossimDpt3d with assumed WGS84 datum.
ossimDpt3d(const ossimGpt &gPt);
ossimDpt3d(const ossimColumnVector3d &pt)
: x(pt[0]), y(pt[1]), z(pt[2]) {}
bool operator ==(const ossimDpt3d &rhs) const
{
return ( (x == rhs.x) &&
(y == rhs.y) &&
(z == rhs.z));
}
bool operator !=(const ossimDpt3d &rhs) const
{
return ( (x != rhs.x) ||
(y != rhs.y) ||
(z != rhs.z) );
}
void makeNan(){x = ossim::nan(); y=ossim::nan(); z=ossim::nan();}
bool hasNans()const
{
return (ossim::isnan(x) || ossim::isnan(y) || ossim::isnan(z));
}
/*!
* METHOD: length()
* Returns the RSS of the components.
*/
double length() const { return std::sqrt(x*x + y*y + z*z); }
double length2() const { return x*x + y*y + z*z; }
//***
// OPERATORS: +, -, +=, -=
// Point add/subtract with other point:
//***
ossimDpt3d operator+(const ossimDpt3d& p) const
{ return ossimDpt3d(x+p.x, y+p.y, z+p.z); }
ossimDpt3d operator-(const ossimDpt3d& p) const
{ return ossimDpt3d(x-p.x, y-p.y, z-p.z); }
const ossimDpt3d& operator+=(const ossimDpt3d& p)
{ x += p.x; y += p.y; z += p.z; return *this; }
const ossimDpt3d& operator-=(const ossimDpt3d& p)
{ x -= p.x; y -= p.y; z -= p.z; return *this; }
//***
// OPERATORS: *, /
// Scale point components by scalar:
//***
ossimDpt3d operator*(const double& d) const
{ return ossimDpt3d(d*x, d*y, d*z); }
ossimDpt3d operator/(const double& d) const
{ return ossimDpt3d(x/d, y/d, z/d); }
void operator /=(double value)
{
x /= value;
y /= value;
z /= value;
}
void operator *=(double value)
{
x *= value;
y *= value;
z *= value;
}
double operator *(const ossimDpt3d& src)const
{
return (x*src.x + y*src.y + z*src.z);
}
inline const ossimDpt3d operator ^ (const ossimDpt3d& rhs) const
{
return ossimDpt3d(y*rhs.z-z*rhs.y,
z*rhs.x-x*rhs.z ,
x*rhs.y-y*rhs.x);
}
/**
* @brief To string method.
*
* @param precision Output floating point precision.
*
* @return std::string representing point.
*
* Output format:
* ( 0.0000000, 0.0000000, 0.00000000 )
* -----x---- -----y---- ------z----
*/
std::string 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);
double x;
double y;
double z;
};
#endif
|