Isis 3 Programmer Reference
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
This class defines a body-fixed surface point.
Definition: SurfacePoint.h:148
NaifVertex m_observer
Three dimensional coordinate position of the observer, in body fixed.
Definition: Intercept.h:84
bool verify(const bool &test, const QString &errmsg, const ErrAction &action=Throw) const
Convenient error handler.
Definition: Intercept.cpp:222
QSharedPointer< AbstractPlate > m_shape
Shape Model for the intercept point.
Definition: Intercept.h:89
Abstract interface to a TIN plate.
Definition: AbstractPlate.h:60
NaifVector m_raydir
Three dimensional ray representing the look direction.
Definition: Intercept.h:85
Angle separationAngle(const NaifVector &raydir) const
Returns the separation angle of the observer and the plate normal.
Definition: Intercept.cpp:199
Namespace for the standard library.
const NaifVector & lookDirectionRay() const
Accessor for the look direction of the intercept.
Definition: Intercept.cpp:116
const AbstractPlate * shape() const
Access the plate for this intercept.
Definition: Intercept.cpp:240
This error is for when a programmer made an API call that was illegal.
Definition: IException.h:162
TNT::Array1D< SpiceDouble > NaifVector
Namespace to contain type definitions of NAIF DSK fundamentals.
Definition: NaifDskApi.h:61
TNT::Array1D< SpiceDouble > NaifVertex
1-D Buffer[3]
Definition: NaifDskApi.h:62
Angle emission() const
Compute the emission of the intercept point from the observer.
Definition: Intercept.cpp:167
virtual ~Intercept()
Empty destructor.
Definition: Intercept.cpp:76
#define _FILEINFO_
Macro for the filename and line number.
Definition: IException.h:40
SurfacePoint location() const
Returns the location of the intercept location on the shape.
Definition: Intercept.cpp:133
bool isValid() const
This method tests the vailidty of the intercept point.
Definition: Intercept.cpp:87
Intercept()
Default empty constructor.
Definition: Intercept.cpp:47
bool validate(const NaifVertex &v)
Verifies that the given NaifVector or NaifVertex is 3 dimensional.
Definition: NaifDskApi.cpp:45
Throw an exception if an error occurs.
Definition: Intercept.h:77
Defines an angle and provides unit conversions.
Definition: Angle.h:62
NaifVector normal() const
Gets the normal vector to the shape for this plate.
Definition: Intercept.cpp:146
Unless noted otherwise, the portions of Isis written by the USGS are public domain.
Isis exception class.
Definition: IException.h:107
Namespace for ISIS/Bullet specific routines.
Definition: Apollo.h:31
const NaifVertex & observer() const
Accessor for the observer position of the intercept.
Definition: Intercept.cpp:104
ErrAction
Enumeration to indicate whether to throw an exception if an error occurs.
Definition: Intercept.h:77
QSharedPointer< SurfacePoint > m_point
Surface point of the intercept location on the body, in body fixed.
Definition: Intercept.h:87
Unless noted otherwise, the portions of Isis written by the USGS are public domain.