41 #include <visp3/core/vpMomentCentered.h> 42 #include <visp3/core/vpMomentGravityCenter.h> 43 #include <visp3/core/vpMomentObject.h> 67 bool found_moment_gravity;
72 if (!found_moment_gravity)
76 for (
unsigned int j = 0; j < (order); j++) {
77 for (
unsigned int i = 0; i < order - j; i++) {
78 unsigned int c = order * j + i;
80 for (
unsigned int k = 0; k <= i; k++) {
81 double Xg_i_k = pow(-momentGravity.
get()[0], (int)(i - k));
82 double comb_i_k =
static_cast<double>(
vpMath::comb(i, k));
83 for (
unsigned int l = 0; l <= j; l++) {
106 assert(i + j <= order);
109 "been computed, you should " 110 "specify a higher order.");
112 return values[j * (order + 1) + i];
135 for (
unsigned int i = 0; i < m.
values.size(); i++) {
157 for (
unsigned int k = 0; k < orderp1; k++) {
158 for (
unsigned int l = 0; l < orderp1 - k; l++) {
159 os <<
"mu[" << k <<
"," << l <<
"] = " << this->
get(k, l) <<
"\t";
174 os << (__FILE__) << std::endl;
184 bool found_moment_gravity;
187 if (!found_moment_gravity)
189 os <<
"Xg = " << momentGravity.
getXg() <<
"\t" 190 <<
"Yg = " << momentGravity.
getYg() << std::endl;
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpMomentCentered &v)
const vpMoment & get(const char *type, bool &found) const
unsigned int getOrder() const
const std::vector< double > & get() const
void printDependencies(std::ostream &os) const
static void printWithIndices(const vpMomentObject &momobj, std::ostream &os)
error that can be emited by ViSP classes.
Class for generic objects.
const vpMomentObject & getObject() const
This class defines shared methods/attributes for 2D moments.
const std::vector< double > & get() const
const std::vector< double > & get() const
This class defines the double-indexed centered moment descriptor .
Class describing 2D gravity center moment.
static long double comb(unsigned int n, unsigned int p)
vpMomentDatabase & getMoments() const
void printWithIndices(std::ostream &os) const
std::vector< double > values
void set(unsigned int i, unsigned int j, double value)