Visual Servoing Platform
version 3.0.1
|
#include <visp3/core/vpMomentDatabase.h>
Public Member Functions | |
vpMomentDatabase () | |
virtual | ~vpMomentDatabase () |
Inherited functionalities from vpMomentDatabase | |
const vpMoment & | get (const char *type, bool &found) const |
vpMoment & | get_first () |
virtual void | updateAll (vpMomentObject &object) |
Friends | |
class | vpMoment |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpMomentDatabase &v) |
This class allows to register all vpMoments so they can access each other according to their dependencies.
Sometimes, a moment needs to have access to other moment's values to be computed. For example vpMomentCentered needs additionnal information about the gravity center vpMomentGravityCenter in order to compute the moment's value from a vpMomentObject. This gravity center should be stored in a vpMomentDatabase where it can be accessed.
All moments in a database can access each other freely at any time. They can also verify if a moment is present in the database or not. Here is a example of a dependency between two moments using a vpMomentDatabase:
The following code outputs:
A moment is identified in the database by it's vpMoment::name method. Consequently, a database can contain at most one moment of each type. Often it is useful to update all moments with the same object. Shortcuts (vpMomentDatabase::updateAll) are provided for that matter.
Definition at line 123 of file vpMomentDatabase.h.
|
inline |
Definition at line 135 of file vpMomentDatabase.h.
|
inlinevirtual |
Definition at line 136 of file vpMomentDatabase.h.
const vpMoment & vpMomentDatabase::get | ( | const char * | type, |
bool & | found | ||
) | const |
Retrieves a moment from the database.
type | : Name of the moment's class. |
found | : true if the moment's type exists in the database, false otherwise. |
Definition at line 61 of file vpMomentDatabase.cpp.
Referenced by vpMomentArea::compute(), vpMomentGravityCenterNormalized::compute(), vpMomentCentered::compute(), vpMomentAreaNormalized::compute(), vpMomentCInvariant::compute(), vpMomentAlpha::compute(), vpFeatureMomentArea::compute_interaction(), vpFeatureMomentCentered::compute_interaction(), vpFeatureMomentAlpha::compute_interaction(), vpFeatureMomentAreaNormalized::compute_interaction(), vpFeatureMomentCInvariant::compute_interaction(), vpFeatureMomentGravityCenter::compute_interaction(), vpFeatureMomentGravityCenterNormalized::compute_interaction(), vpMomentArea::printDependencies(), vpMomentGravityCenterNormalized::printDependencies(), vpMomentCentered::printDependencies(), vpMomentAreaNormalized::printDependencies(), vpMomentAlpha::printDependencies(), and vpFeatureMoment::update().
|
inline |
Get the first element in the database. May be useful in case an unnamed object is present but is the only element in the database.
Definition at line 146 of file vpMomentDatabase.h.
|
virtual |
Updates the moment object for all moments in the database
object | : Moment object for which all the moments in the database should be updated. |
Sometimes, it might be useful to update the whole database when computing only one moment when this moment depends on other moments. The example provided in the header of this class gives an example that shows how to compute gravity center moment and the centered moment using a mass update.
Reimplemented in vpMomentCommon.
Definition at line 75 of file vpMomentDatabase.cpp.
Referenced by vpMomentCommon::getAlpha(), vpMomentCommon::getMu3(), vpMomentCommon::getSurface(), and vpMomentCommon::updateAll().
|
friend |
Outputs all the moments values in the database to a stream.
Definition at line 85 of file vpMomentDatabase.cpp.
|
friend |
Definition at line 151 of file vpMomentDatabase.h.