#include <CoordinateSystem.h>
Public Member Functions | |
VivaldiCoordsInfo (bool useHeightVector=false) | |
bool | isValid () |
double | getError () const |
void | setError (double err) |
double | getHeightVector () const |
void | setHeightVector (double height) |
Prox | getDistance (const AbstractNcsNodeInfo &node) const |
bool | update (const AbstractNcsNodeInfo &info) |
operator std::vector< double > () const | |
Protected Attributes | |
double | coordErr |
double | heightVector |
Definition at line 97 of file CoordinateSystem.h.
VivaldiCoordsInfo::VivaldiCoordsInfo | ( | bool | useHeightVector = false |
) | [inline] |
Definition at line 100 of file CoordinateSystem.h.
00100 { 00101 coordErr = 1.0; 00102 heightVector = (useHeightVector ? 0 : -1.0); 00103 };
Prox VivaldiCoordsInfo::getDistance | ( | const AbstractNcsNodeInfo & | node | ) | const [virtual] |
Implements AbstractNcsNodeInfo.
Definition at line 87 of file CoordinateSystem.cc.
Referenced by Vivaldi::getCoordinateBasedProx(), and Vivaldi::processCoordinates().
00088 { 00089 if (!dynamic_cast<const VivaldiCoordsInfo*>(&abstractInfo)) { 00090 return Prox::PROX_UNKNOWN; 00091 } 00092 const VivaldiCoordsInfo& info = 00093 *(static_cast<const VivaldiCoordsInfo*>(&abstractInfo)); 00094 00095 double dist = 0.0, accuracy = 0.0; 00096 00097 for (uint8_t i = 0; i < info.getDimension(); ++i) { 00098 dist += pow(getCoords(i) - info.getCoords(i), 2); 00099 } 00100 dist = sqrt(dist); 00101 00102 accuracy = 1 - ((info.getError() + getError()) / 2); 00103 if (info.getError() >= 1.0 || getError() >= 1.0) accuracy = 0.0; 00104 if (accuracy < 0) accuracy = 0.0; 00105 if (accuracy > 1) accuracy = 1; 00106 00107 if (getHeightVector() != -1.0 && info.getHeightVector() != -1.0) { 00108 return Prox(dist + getHeightVector() + info.getHeightVector(), 00109 info.getError()); 00110 } 00111 return Prox(dist, accuracy); 00112 }
double VivaldiCoordsInfo::getError | ( | ) | const [inline] |
Definition at line 107 of file CoordinateSystem.h.
Referenced by Vivaldi::calcError(), SVivaldi::calcError(), Vivaldi::finishVivaldi(), getDistance(), Vivaldi::getOwnError(), operator<<(), and Vivaldi::processCoordinates().
00107 { return coordErr; };
double VivaldiCoordsInfo::getHeightVector | ( | ) | const [inline] |
Definition at line 112 of file CoordinateSystem.h.
Referenced by getDistance(), Vivaldi::getOwnHeightVector(), operator<<(), and Vivaldi::processCoordinates().
00112 { return heightVector; };
bool VivaldiCoordsInfo::isValid | ( | ) | [inline, virtual] |
Implements AbstractNcsNodeInfo.
Definition at line 105 of file CoordinateSystem.h.
VivaldiCoordsInfo::operator std::vector< double > | ( | ) | const [virtual] |
Implements AbstractNcsNodeInfo.
Definition at line 129 of file CoordinateSystem.cc.
00129 { 00130 std::vector<double> temp; 00131 for (uint8_t i = 0; i < coordinates.size(); ++i) { 00132 temp.push_back(coordinates[i]); 00133 } 00134 temp.push_back(coordErr); 00135 if (heightVector >= 0) temp.push_back(heightVector); 00136 00137 return temp; 00138 }
void VivaldiCoordsInfo::setError | ( | double | err | ) | [inline] |
Definition at line 108 of file CoordinateSystem.h.
Referenced by Vivaldi::processCoordinates().
void VivaldiCoordsInfo::setHeightVector | ( | double | height | ) | [inline] |
Definition at line 113 of file CoordinateSystem.h.
Referenced by Vivaldi::init(), and Vivaldi::processCoordinates().
00113 { 00114 heightVector = ((height > 0.0) ? height : 0.0); 00115 };
bool VivaldiCoordsInfo::update | ( | const AbstractNcsNodeInfo & | info | ) | [virtual] |
Implements AbstractNcsNodeInfo.
Definition at line 114 of file CoordinateSystem.cc.
00115 { 00116 if (!dynamic_cast<const VivaldiCoordsInfo*>(&info)) return false; 00117 00118 const VivaldiCoordsInfo& temp = static_cast<const VivaldiCoordsInfo&>(info); 00119 if (coordErr > temp.coordErr) { 00120 coordErr = temp.coordErr; 00121 coordinates = temp.coordinates; 00122 heightVector = temp.heightVector; 00123 00124 return true; 00125 } 00126 return false; 00127 }
double VivaldiCoordsInfo::coordErr [protected] |
Definition at line 122 of file CoordinateSystem.h.
Referenced by getError(), isValid(), operator std::vector< double >(), setError(), update(), and VivaldiCoordsInfo().
double VivaldiCoordsInfo::heightVector [protected] |
Definition at line 123 of file CoordinateSystem.h.
Referenced by getHeightVector(), operator std::vector< double >(), setHeightVector(), update(), and VivaldiCoordsInfo().