41 #include <visp3/core/vpMomentCentered.h>
42 #include <visp3/core/vpMomentGravityCenter.h>
43 #include <visp3/core/vpMomentObject.h>
68 bool found_moment_gravity;
73 if (!found_moment_gravity)
77 for (
unsigned int j = 0; j < (order); j++) {
78 for (
unsigned int i = 0; i < order - j; i++) {
79 unsigned int c = order * j + i;
81 for (
unsigned int k = 0; k <= i; k++) {
82 double Xg_i_k = pow(-momentGravity.
get()[0], (
int)(i - k));
83 double comb_i_k =
static_cast<double>(
vpMath::comb(i, k));
84 for (
unsigned int l = 0; l <= j; l++) {
107 assert(i + j <= order);
110 "been computed, you should "
111 "specify a higher order.");
113 return values[j * (order + 1) + i];
122 for (
unsigned int k = 0; k < orderp1; k++) {
123 for (
unsigned int l = 0; l < orderp1 - k; l++) {
124 os <<
"mu[" << k <<
"," << l <<
"] = " << this->
get(k, l) <<
"\t";
139 os << (__FILE__) << std::endl;
149 bool found_moment_gravity;
152 if (!found_moment_gravity)
154 os <<
"Xg = " << momentGravity.
getXg() <<
"\t"
155 <<
"Yg = " << momentGravity.
getYg() << std::endl;
178 for (
unsigned int i = 0; i < m.
values.size(); i++) {
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
@ notInitialized
Used to indicate that a parameter is not initialized.
static long double comb(unsigned int n, unsigned int p)
This class defines the double-indexed centered moment descriptor .
const std::vector< double > & get() const
void printDependencies(std::ostream &os) const
void printWithIndices(std::ostream &os) const
void set(unsigned int i, unsigned int j, double value)
const vpMoment & get(const std::string &moment_name, bool &found) const
Class describing 2D gravity center moment.
const std::vector< double > & get() const
Class for generic objects.
static void printWithIndices(const vpMomentObject &momobj, std::ostream &os)
unsigned int getOrder() const
const std::vector< double > & get() const
This class defines shared methods/attributes for 2D moments.
std::vector< double > values
const vpMomentObject & getObject() const
vpMomentDatabase & getMoments() const