OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimLsrVector.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 //
6 // DESCRIPTION:
7 // Contains implementation of class
8 //
9 // SOFTWARE HISTORY:
10 //>
11 // ddmmm2001 Oscar Kramer (okramer@imagelinks.com)
12 // Initial coding.
13 //<
14 //*****************************************************************************
15 // $Id: ossimLsrVector.cpp 12790 2008-05-05 13:41:33Z dburken $
16 
19 #include <ossim/base/ossimCommon.h>
20 
21 //*****************************************************************************
22 // CONSTRUCTOR: ossimLsrVector(ossimEcefVector, ossimLsrSpace)
23 //
24 // Establishes an LSR vector given the ECEF equivalent and the LSR space.
25 //
26 //*****************************************************************************
28  const ossimLsrSpace& new_space)
29  : theLsrSpace (new_space)
30 {
31  initialize(convert_this);
32 }
33 
34 //*****************************************************************************
35 // CONSTRUCTOR: ossimLsrVector(ossimLsrVector, ossimLsrSpace)
36 //
37 // Establishes an LSR vector in a new space given another LSR vector in a
38 // different space.
39 //
40 //*****************************************************************************
42  const ossimLsrSpace& new_space)
43  : theLsrSpace (new_space)
44 {
45  initialize(ossimEcefVector(convert_this));
46 }
47 
48 //*****************************************************************************
49 // METHOD: ossimLsrVector::dot(ossimLsrVector)
50 //
51 // Computes the scalar product.
52 //
53 //*****************************************************************************
54 double ossimLsrVector::dot(const ossimLsrVector& v) const
55 {
56  if(hasNans()||v.hasNans()||(theLsrSpace != v.theLsrSpace))
57  {
59  return ossim::nan();
60  }
61  return theData.dot(v.data());
62 }
63 
64 //*****************************************************************************
65 // METHOD: ossimLsrVector::angleTo(ossimLsrVector)
66 //
67 // Returns the angle subtended (in DEGREES) between this and arg vector
68 //
69 //*****************************************************************************
71 {
72  if(hasNans()||v.hasNans()||(theLsrSpace != v.theLsrSpace))
73  {
75  return ossim::nan();
76  }
77  double mag_product = theData.magnitude() * v.theData.magnitude();
78  return ossim::acosd(theData.dot(v.theData)/mag_product);
79 }
80 
81 //*****************************************************************************
82 // METHOD: ossimLsrVector::cross(ossimLsrVector)
83 //
84 // Computes the cross product.
85 //
86 //*****************************************************************************
88 {
89  if(hasNans()||v.hasNans()||(theLsrSpace != v.theLsrSpace))
90  {
93  theLsrSpace);
94  }
96 }
97 
99 {
100  os << "(ossimLsrVector)\n"
101  << " theData = " << theData
102  << "\n theLsrSpace = " << theLsrSpace;
103  return os;
104 }
105 
107  const ossimLsrVector& instance)
108 {
109  return instance.print(os);
110 }
111 
void initialize(const ossimEcefVector &ecef_point)
static ostream & lsrSpaceErrorMessage(ostream &os=ossimNotify(ossimNotifyLevel_INFO))
ossimColumnVector3d cross(const ossimColumnVector3d &rhs) const
double dot(const ossimColumnVector3d &rhs) const
double nan()
Method to return ieee floating point double precision NAN.
Definition: ossimCommon.h:135
double dot(const ossimLsrVector &) const
ossimColumnVector3d & data()
double acosd(double x)
Definition: ossimCommon.h:264
bool hasNans() const
ossimLsrSpace theLsrSpace
ossimColumnVector3d theData
double angleTo(const ossimLsrVector &) const
std::ostream & print(ostream &stream) const
ossimLsrVector cross(const ossimLsrVector &) const
std::ostream & operator<<(std::ostream &os, const ossimLsrVector &instance)
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23