USGS

Isis 3.0 Object Programmers' Reference

Home

Intercept.cpp
Go to the documentation of this file.
1 
25 #include "Intercept.h"
26 
27 #include <numeric>
28 #include <string>
29 #include <vector>
30 
31 #include <QtGlobal>
32 
33 #include "Angle.h"
34 #include "AbstractPlate.h"
35 #include "IException.h"
36 #include "IString.h"
37 #include "NaifDskApi.h"
38 #include "Latitude.h"
39 #include "Longitude.h"
40 #include "SurfacePoint.h"
41 
42 using namespace std;
43 
44 namespace Isis {
45 
47  Intercept::Intercept() : m_observer(), m_raydir(), m_point(0), m_shape(0) { }
48 
49 
50 
67  Intercept::Intercept(const NaifVertex &observer, const NaifVector &raydir,
68  SurfacePoint *ipoint, AbstractPlate *shape) :
69  m_observer(observer.copy()), m_raydir(raydir.copy()),
70  m_point(ipoint), m_shape(shape) {}
71 
72 
73 
74 
77 
78 
79 
87  bool Intercept::isValid() const {
88  bool valid = true;
89  if ( !validate( m_observer ) ) valid = false;
90  if ( !validate( m_raydir ) ) valid = false;
91  if ( m_point.isNull() ) valid = false;
92  if ( m_shape.isNull() ) valid = false;
93  return valid;
94  }
95 
96 
97 
105  return (m_observer);
106  }
107 
108 
109 
117  return (m_raydir);
118  }
119 
120 
121 
134  verify( isValid(), "Unable to return Intercept location. Invalid/undefined Intercept point.");
135  return (SurfacePoint(*m_point));
136  }
137 
138 
139 
147  verify( isValid(), "Unable to return Intercept normal. Invalid/undefined Intercept point.");
148  return ( m_shape->normal() );
149  }
150 
151 
152 
153 
168  verify( isValid(),
169  "Unable to return Intercept emission angle. Invalid/undefined Intercept point." );
170 
171  // Point back toward the center of the body
172  NaifVertex point(3);
173  m_point->ToNaifArray(&point[0]);
174 
175  NaifVector raydir(3);
176  vsub_c(&m_observer[0], &point[0], &raydir[0]);
177 
178  // Return the separation angle between them
179  return (separationAngle(raydir));
180  }
181 
182 
183 
200  verify( isValid(),
201  "Unable to return Intercept separation angle. Invalid/undefined Intercept point.");
202  return (m_shape->separationAngle(raydir));
203  }
204 
205 
206 
222  bool Intercept::verify(const bool &test, const QString &errmsg,
223  const Intercept::ErrAction &action) const {
224  if ( ( Throw == action ) && ( !test ) ) {
226  }
227 
228  // Looks good
229  return ( test );
230  }
231 
232 
233 
241  return ( m_shape.data() );
242  }
243 
244 }
245 // namespace Isis