OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimLsrRay.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // FILE: ossimLsrRay.h
3 //
4 // Copyright (C) 2001 ImageLinks, Inc.
5 //
6 // License: See top level LICENSE.txt file.
7 //
8 // DESCRIPTION:
9 // Class for representing rays in some local space rectangular (LSR)
10 // coordinate system. This coordinate system is related to the ECEF system
11 // by the ossimLsrSpace member object. This class simplifies coordinate
12 // conversions between LSR and ECEF, and other LSR spaces.
13 //
14 // An LSR ray is defined as having an LSR origin point and an LSR unit
15 // direction vector radiating from the origin.
16 //
17 // SOFTWARE HISTORY:
18 //>
19 // 08Aug2001 Oscar Kramer
20 // Initial coding.
21 //<
22 //*****************************************************************************
23 // $Id: ossimLsrRay.h 11428 2007-07-27 18:44:18Z gpotts $
24 
25 #ifndef ossimLsrRay_HEADER
26 #define ossimLsrRay_HEADER
27 
32 
33 //*****************************************************************************
34 // CLASS: ossimLsrRay
35 //
36 //*****************************************************************************
38 {
39 public:
44 
45  ossimLsrRay(const ossimLsrRay& copy_this)
46  : theOrigin(copy_this.theOrigin), theDirection(copy_this.theDirection) {}
47 
48  ossimLsrRay(const ossimLsrPoint& origin,
49  const ossimLsrVector& direction);
50 
51  ossimLsrRay(const ossimLsrPoint& origin,
52  const ossimLsrPoint& towards);
53 
54  ossimLsrRay(const ossimLsrRay& convert_this,
55  const ossimLsrSpace& new_space)
56  : theOrigin(convert_this.theOrigin, new_space),
57  theDirection(convert_this.theDirection, new_space) {}
58 
62  const ossimLsrRay& operator= (const ossimLsrRay& r); // inline below
63  bool operator==(const ossimLsrRay& r) const; // inline below
64  bool operator!=(const ossimLsrRay& r) const; // inline below
65 
69  const ossimLsrPoint& origin() const { return theOrigin; }
70  const ossimLsrVector& direction() const { return theDirection; }
71  const ossimLsrSpace& lsrSpace() const { return theOrigin.lsrSpace(); }
72 
78  operator ossimEcefRay () const; // inline below
79 
80  bool hasNans()const
81  {
82  return (theOrigin.hasNans()||theDirection.hasNans());
83  }
84 
85  void makeNan()
86  {
87  theOrigin.makeNan();
88  theDirection.makeNan();
89  }
95  ossimLsrPoint extend(const double& t) const
96  {
97  if(!hasNans())
98  {
99  return (theOrigin + theDirection*t);
100  }
101 
102  ossimLsrPoint p;
103  p.makeNan();
104  return p;
105  }
106 
110  void print(ostream& stream = ossimNotify(ossimNotifyLevel_INFO)) const; // inline below
111 
112  friend ostream& operator<< (ostream& os , const ossimLsrRay& instance)
113  { instance.print(os); return os; }
114 
115 private:
118 
119 };
120 
121 //================== BEGIN DEFINITIONS FOR INLINE METHODS =====================
122 
123 //*****************************************************************************
124 // INLINE METHOD: ossimEcefRay::operator=(ossimEcefRay)
125 //*****************************************************************************
127 {
128  theOrigin = r.theOrigin;
130  return *this;
131 }
132 
133 //*****************************************************************************
134 // INLINE METHOD: ossimEcefRay::operator==(ossimEcefRay)
135 //*****************************************************************************
136 inline bool ossimLsrRay::operator==(const ossimLsrRay& r) const
137 {
138  return ((theOrigin == r.theOrigin) && (theDirection == r.theDirection));
139 }
140 
141 //*****************************************************************************
142 // INLINE METHOD: ossimEcefRay::operator!=(ossimEcefRay)
143 //*****************************************************************************
144 inline bool ossimLsrRay::operator!=(const ossimLsrRay& r) const
145 {
146  return !(*this == r);
147 }
148 
149 //*****************************************************************************
150 // INLINE CASTING OPERATOR: ossimEcefRay()
151 //
152 // Looks like a constructor for an ossimEcefRay but is an operation on this
153 // object. Returns the ossimEcefRay equivalent.
154 //*****************************************************************************
155 inline ossimLsrRay::operator ossimEcefRay() const
156 {
157  return ossimEcefRay(ossimEcefPoint(theOrigin),
158  ossimEcefVector(theDirection));
159 }
160 
161 //*****************************************************************************
162 // INLINE METHOD: ossimLsrRay::print(ostream)
163 // Dumps contents for debug purposes.
164 //*****************************************************************************
165 inline void ossimLsrRay::print(ostream& os) const
166 {
167  os << "(ossimLsrRay)"
168  << "\n theOrigin = " << theOrigin
169  << "\n theDirection = " << theDirection << ends;
170 }
171 
172 #endif
173 
174 
ossimLsrRay(const ossimLsrRay &convert_this, const ossimLsrSpace &new_space)
Definition: ossimLsrRay.h:54
bool operator==(const ossimLsrRay &r) const
Definition: ossimLsrRay.h:136
#define OSSIMDLLEXPORT
bool operator!=(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:111
bool hasNans() const
Definition: ossimLsrRay.h:80
ossimLsrVector theDirection
Definition: ossimLsrRay.h:117
void makeNan()
Definition: ossimLsrRay.h:85
void print(ostream &stream=ossimNotify(ossimNotifyLevel_INFO)) const
Definition: ossimLsrRay.h:165
std::ostream & print(H5::H5File *file, std::ostream &out)
Print method.
Definition: ossimH5Util.cpp:41
ostream & operator<<(ostream &out, const ossimAxes &axes)
Definition: ossimAxes.h:88
const ossimLsrRay & operator=(const ossimLsrRay &r)
Definition: ossimLsrRay.h:126
ossimLsrPoint extend(const double &t) const
Definition: ossimLsrRay.h:95
ossimLsrRay(const ossimLsrRay &copy_this)
Definition: ossimLsrRay.h:45
bool operator==(const ossimRefPtr< _Tp1 > &__a, const ossimRefPtr< _Tp2 > &__b) noexcept
Definition: ossimRefPtr.h:101
const ossimLsrSpace & lsrSpace() const
Definition: ossimLsrRay.h:71
ossimLsrPoint theOrigin
Definition: ossimLsrRay.h:116
const ossimLsrPoint & origin() const
Definition: ossimLsrRay.h:69
const ossimLsrVector & direction() const
Definition: ossimLsrRay.h:70
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23
bool operator!=(const ossimLsrRay &r) const
Definition: ossimLsrRay.h:144