44#ifndef _vpFeatureMomentDatabase_h_
45#define _vpFeatureMomentDatabase_h_
50#include <visp3/core/vpConfig.h>
108 vpMomentObject obj(6); // Init object of order 6 because we are
109 // computing C-invariants
110 obj.setType(vpMomentObject::DISCRETE); // Discrete mode for object
111 obj.fromVector(vec_p);
113 vpMomentDatabase mdb; // database for moment primitives. This will
114 // only contain the basic moment.
115 vpMomentCentered mc; // Centered moment
116 vpMomentBasic bm; // Basic moment
117 vpMomentGravityCenter gc; // gravity center
118 vpMomentCInvariant ci; // C-type invariant
120 bm.linkTo(mdb); //add basic moment to moment database
121 mc.linkTo(mdb); //add centered moment to moment database
122 gc.linkTo(mdb); //add gravity center to moment database
123 ci.linkTo(mdb); //add C-invariant to moment database
125 vpFeatureMomentDatabase fmdb; // feature moment database to store
126 // feature dependencies
128 // Declare and link moments to database
129 vpFeatureMomentBasic fmb(mdb,0.,0.,1.,&fmdb); fmb.linkTo(fmdb);
130 vpFeatureMomentCentered fmc(mdb,0.,0.,1.,&fmdb); fmc.linkTo(fmdb);
131 vpFeatureMomentCInvariant fci(mdb,0.,0.,1.,&fmdb); fci.linkTo(fmdb);
133 // update the whole moment database
136 // Compute moments in the correct order with the object
142 // update the whole feature moment database with a plane
143 fmb.update(0.,0.,1.);
144 fmc.update(0.,0.,1.);
145 fci.update(0.,0.,1.);
147 std::cout << fci.interaction(vpFeatureMomentCInvariant::selectC1()) << std::endl;
149 catch(const vpException &e){
150 std::cout << e.getMessage() << std::endl;
161 bool operator()(
const char *a,
const char *b)
const {
return std::strcmp(a, b) < 0; }
162 char *operator=(
const char *) {
return NULL; }
164 std::map<const char *, vpFeatureMoment *, vpCmpStr_t> featureMomentsDataBase;
176 virtual void updateAll(
double A = 0.0,
double B = 0.0,
double C = 1.0);
vpFeatureMomentDatabase()
virtual ~vpFeatureMomentDatabase()
friend class vpFeatureMoment
This class defines shared system methods/attributes for 2D moment features but no functional code....
Class for generic objects.