OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimEcefRay.h
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // DESCRIPTION:
6 // Class for representing a ray in the earth-centered, earth-fixed (ECEF)
7 // coordinate system. A ray is defined as having an origin point and a
8 // unit direction vector radiating from the origin.
9 //
10 // SOFTWARE HISTORY:
11 //>
12 // 08Aug2001 Oscar Kramer (okramer@imagelinks.com)
13 // Initial coding.
14 //<
15 //*****************************************************************************
16 // $Id: ossimEcefRay.h 12769 2008-04-30 17:46:18Z dburken $
17 
18 #ifndef ossimEcefRay_HEADER
19 #define ossimEcefRay_HEADER
20 
21 #include <iosfwd>
22 
26 #include <ossim/base/ossimNotify.h>
27 
28 class ossimGpt;
29 class ossimLsrRay;
30 
31 //*****************************************************************************
32 // CLASS: ossimEcefRay
33 //
34 //*****************************************************************************
36 {
37 public:
42 
43  ossimEcefRay(const ossimEcefRay& copy_this)
44  : theOrigin(copy_this.theOrigin), theDirection(copy_this.theDirection) {}
45 
47  const ossimEcefVector& direction)
48  : theOrigin(origin), theDirection(direction.unitVector()) {}
49 
50  ossimEcefRay(const ossimEcefPoint& from,
51  const ossimEcefPoint& to);
52 
53  ossimEcefRay(const ossimGpt& from,
54  const ossimGpt& to);
55 
56  bool isNan()const
57  {
58  return theOrigin.isNan()&&theDirection.isNan();
59  }
60  bool hasNans()const
61  {
62  return theOrigin.isNan()||theDirection.isNan();
63  }
64  void makeNan()
65  {
66  theOrigin.makeNan();
67  theDirection.makeNan();
68  }
72  const ossimEcefRay& operator= (const ossimEcefRay& r); // inline below
73  bool operator==(const ossimEcefRay& r) const; // inline below
74  bool operator!=(const ossimEcefRay& r) const; // inline below
75 
79  const ossimEcefPoint& origin() const { return theOrigin; }
80  const ossimEcefVector& direction() const { return theDirection; }
81  void setOrigin(const ossimEcefPoint& orig) { theOrigin = orig; }
82  void setDirection(const ossimEcefVector& d) { theDirection=d.unitVector();}
83 
88  ossimEcefPoint extend(const double& t) const; // inline below
89 
95  ossimEcefRay reflectRay(const ossimEcefVector& normal) const;// inline below
96 
100  ossimEcefPoint intersectAboveEarthEllipsoid
101  (const double& heightAboveEllipsoid,
102  const ossimDatum* aDatum = ossimDatumFactory::instance()->wgs84()) const;
103 
109 
110  friend std::ostream& operator<<(std::ostream& os ,
111  const ossimEcefRay& instance);
112 
113 private:
116 };
117 
118 //================== BEGIN DEFINITIONS FOR INLINE METHODS =====================
119 
120 //*****************************************************************************
121 // INLINE METHOD: ossimEcefRay::operator=(ossimEcefRay)
122 //*****************************************************************************
124 {
125  theOrigin = r.theOrigin;
127  return *this;
128 }
129 
130 //*****************************************************************************
131 // INLINE METHOD: ossimEcefRay::operator==(ossimEcefRay)
132 //*****************************************************************************
133 inline bool ossimEcefRay::operator==(const ossimEcefRay& r) const
134 {
135  return ((theOrigin == r.theOrigin) && (theDirection == r.theDirection));
136 }
137 
138 //*****************************************************************************
139 // INLINE METHOD: ossimEcefRay::operator!=(ossimEcefRay)
140 //*****************************************************************************
141 inline bool ossimEcefRay::operator!=(const ossimEcefRay& r) const
142 {
143  return !(*this == r);
144 }
145 
146 //*****************************************************************************
147 // INLINE METHOD: ossimEcefRay::extend(double t)
148 //
149 // Extends the ray by distance t (meters) from the origin to the ECEF
150 // point returned.
151 //*****************************************************************************
152 inline ossimEcefPoint ossimEcefRay::extend(const double& t) const
153 {
154  return (theOrigin + theDirection*t);
155 }
156 
157 //*****************************************************************************
158 // INLINE METHOD: ossimEcefRay::reflectRay(normal)
159 //
160 // This method computes a ray with the same origin but a new direction
161 // corresponding to a reflection from some surface defined by its normal
162 // vector:
163 //*****************************************************************************
164 inline ossimEcefRay
166 {
167  ossimEcefVector new_dir(theDirection - normal*2.0*normal.dot(theDirection));
168  return ossimEcefRay(theOrigin, new_dir);
169 }
170 
171 
172 #endif
173 
174 
ossimEcefVector unitVector() const
bool operator!=(const ossimEcefRay &r) const
Definition: ossimEcefRay.h:141
#define OSSIMDLLEXPORT
bool operator!=(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:111
double dot(const ossimEcefVector &) const
const ossimEcefPoint & origin() const
Definition: ossimEcefRay.h:79
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41
const ossimEcefRay & operator=(const ossimEcefRay &r)
Definition: ossimEcefRay.h:123
void setOrigin(const ossimEcefPoint &orig)
Definition: ossimEcefRay.h:81
bool hasNans() const
Definition: ossimEcefRay.h:60
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
bool isNan() const
Definition: ossimEcefRay.h:56
static ossimDatumFactory * instance()
ossimEcefVector theDirection
Definition: ossimEcefRay.h:115
bool operator==(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:101
ossimEcefRay(const ossimEcefPoint &origin, const ossimEcefVector &direction)
Definition: ossimEcefRay.h:46
ossimEcefRay reflectRay(const ossimEcefVector &normal) const
Definition: ossimEcefRay.h:165
ossimEcefPoint extend(const double &t) const
Definition: ossimEcefRay.h:152
const ossimEcefVector & direction() const
Definition: ossimEcefRay.h:80
ossimEcefPoint theOrigin
Definition: ossimEcefRay.h:114
bool operator==(const ossimEcefRay &r) const
Definition: ossimEcefRay.h:133
void setDirection(const ossimEcefVector &d)
Definition: ossimEcefRay.h:82
ossimEcefRay(const ossimEcefRay &copy_this)
Definition: ossimEcefRay.h:43
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
void makeNan()
Definition: ossimEcefRay.h:64