Visual Servoing Platform
version 3.6.1 under development (2024-11-21)
|
#include <visp3/core/vpMomentDatabase.h>
Public Member Functions | |
vpMomentDatabase () | |
virtual | ~vpMomentDatabase () |
Inherited functionalities from vpMomentDatabase | |
class | vpMoment |
VISP_EXPORT std::ostream & | operator<< (std::ostream &os, const vpMomentDatabase &v) |
const vpMoment & | get (const std::string &moment_name, bool &found) const |
vpMoment & | get_first () |
virtual void | updateAll (vpMomentObject &object) |
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 additional 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 132 of file vpMomentDatabase.h.
|
inline |
Definition at line 145 of file vpMomentDatabase.h.
|
inlinevirtual |
Definition at line 146 of file vpMomentDatabase.h.
const vpMoment & vpMomentDatabase::get | ( | const std::string & | moment_name, |
bool & | found | ||
) | const |
Retrieves a moment from the database.
moment_name | : Name of the moment's class. |
found | : true if the moment's type exists in the database, false otherwise. |
Definition at line 65 of file vpMomentDatabase.cpp.
Referenced by vpMomentAlpha::compute(), vpMomentArea::compute(), vpMomentAreaNormalized::compute(), vpMomentCentered::compute(), vpMomentCInvariant::compute(), vpMomentGravityCenterNormalized::compute(), vpFeatureMomentAlpha::compute_interaction(), vpFeatureMomentArea::compute_interaction(), vpFeatureMomentAreaNormalized::compute_interaction(), vpFeatureMomentCentered::compute_interaction(), vpFeatureMomentCInvariant::compute_interaction(), vpFeatureMomentGravityCenter::compute_interaction(), vpFeatureMomentGravityCenterNormalized::compute_interaction(), vpMomentAlpha::printDependencies(), vpMomentArea::printDependencies(), vpMomentAreaNormalized::printDependencies(), vpMomentCentered::printDependencies(), vpMomentGravityCenterNormalized::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 158 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 83 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 94 of file vpMomentDatabase.cpp.
|
friend |
Definition at line 163 of file vpMomentDatabase.h.