OverSim
VivaldiCoordsInfo Class Reference

#include <CoordinateSystem.h>

Inheritance diagram for VivaldiCoordsInfo:
EuclideanNcsNodeInfo AbstractNcsNodeInfo

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 Coords () const
- Public Member Functions inherited from EuclideanNcsNodeInfo
 EuclideanNcsNodeInfo ()
virtual ~EuclideanNcsNodeInfo ()
uint8_t getDimension () const
double getCoords (uint8_t i) const
const CoordsgetCoords () const
void setCoords (uint8_t i, double value)
- Public Member Functions inherited from AbstractNcsNodeInfo
virtual ~AbstractNcsNodeInfo ()

Protected Attributes

double coordErr
double heightVector
- Protected Attributes inherited from EuclideanNcsNodeInfo
Coords coordinates

Additional Inherited Members

- Static Public Member Functions inherited from EuclideanNcsNodeInfo
static void setDimension (uint8_t dimension)
- Static Protected Attributes inherited from EuclideanNcsNodeInfo
static uint8_t dim

Detailed Description

Definition at line 142 of file CoordinateSystem.h.

Constructor & Destructor Documentation

VivaldiCoordsInfo::VivaldiCoordsInfo ( bool  useHeightVector = false)
inline

Definition at line 145 of file CoordinateSystem.h.

{
coordErr = 1.0;
heightVector = (useHeightVector ? 0 : -1.0);
};

Member Function Documentation

Prox VivaldiCoordsInfo::getDistance ( const AbstractNcsNodeInfo node) const
virtual

Reimplemented from EuclideanNcsNodeInfo.

Definition at line 93 of file CoordinateSystem.cc.

Referenced by Vivaldi::getCoordinateBasedProx(), and Vivaldi::processCoordinates().

{
if (!dynamic_cast<const VivaldiCoordsInfo*>(&abstractInfo)) {
}
const VivaldiCoordsInfo& info =
*(static_cast<const VivaldiCoordsInfo*>(&abstractInfo));
double dist = 0.0, accuracy = 0.0;
for (uint8_t i = 0; i < info.getDimension(); ++i) {
dist += pow(getCoords(i) - info.getCoords(i), 2);
}
dist = sqrt(dist) / 1000;
accuracy = 1 - ((info.getError() + getError()) / 2);
if (info.getError() >= 1.0 || getError() >= 1.0) accuracy = 0.0;
if (accuracy < 0) accuracy = 0.0;
if (accuracy > 1) accuracy = 1;
if (getHeightVector() != -1.0 && info.getHeightVector() != -1.0) {
return Prox(dist + getHeightVector() + info.getHeightVector(),
info.getError());
}
return Prox(dist, accuracy);
}
double VivaldiCoordsInfo::getError ( ) const
inline
double VivaldiCoordsInfo::getHeightVector ( ) const
inline
bool VivaldiCoordsInfo::isValid ( )
inlinevirtual

Implements AbstractNcsNodeInfo.

Definition at line 150 of file CoordinateSystem.h.

{ return coordErr >= 0.0 && coordErr < 1.0; };
VivaldiCoordsInfo::operator Coords ( ) const
virtual

Implements AbstractNcsNodeInfo.

Definition at line 135 of file CoordinateSystem.cc.

{
Coords temp;
for (uint8_t i = 0; i < coordinates.size(); ++i) {
temp.push_back(coordinates[i]);
}
temp.push_back(coordErr);
if (heightVector >= 0) temp.push_back(heightVector);
return temp;
}
void VivaldiCoordsInfo::setError ( double  err)
inline

Definition at line 153 of file CoordinateSystem.h.

Referenced by Vivaldi::processCoordinates().

{
if (err > 1.0) {
coordErr = 1.0;
} else if (err < 0.0) {
coordErr = 0.0;
} else {
coordErr = err;
}
//coordErr = ((err > 1.0) ? 1.0 : ((err < 0.0) ? 0.0 : coordErr = err));
};
void VivaldiCoordsInfo::setHeightVector ( double  height)
inline

Definition at line 165 of file CoordinateSystem.h.

Referenced by Vivaldi::init(), and Vivaldi::processCoordinates().

{
heightVector = ((height > 0.0) ? height : 0.0);
};
bool VivaldiCoordsInfo::update ( const AbstractNcsNodeInfo info)
virtual

Implements AbstractNcsNodeInfo.

Definition at line 120 of file CoordinateSystem.cc.

{
if (!dynamic_cast<const VivaldiCoordsInfo*>(&info)) return false;
const VivaldiCoordsInfo& temp = static_cast<const VivaldiCoordsInfo&>(info);
if (coordErr > temp.coordErr) {
return true;
}
return false;
}

Member Data Documentation

double VivaldiCoordsInfo::coordErr
protected

Definition at line 174 of file CoordinateSystem.h.

Referenced by getError(), isValid(), setError(), update(), and VivaldiCoordsInfo().

double VivaldiCoordsInfo::heightVector
protected

Definition at line 175 of file CoordinateSystem.h.

Referenced by getHeightVector(), setHeightVector(), update(), and VivaldiCoordsInfo().


The documentation for this class was generated from the following files: