36#include <visp3/core/vpMomentCentered.h>
37#include <visp3/core/vpMomentGravityCenter.h>
38#include <visp3/core/vpMomentObject.h>
63 bool found_moment_gravity;
68 if (!found_moment_gravity)
72 for (
unsigned int j = 0; j < (order); j++) {
73 for (
unsigned int i = 0; i < order - j; i++) {
74 unsigned int c = order * j + i;
76 for (
unsigned int k = 0; k <= i; k++) {
77 double Xg_i_k = pow(-momentGravity.
get()[0],
static_cast<int>(i - k));
78 double comb_i_k =
static_cast<double>(
vpMath::comb(i, k));
79 for (
unsigned int l = 0; l <= j; l++) {
81 pow(-momentGravity.
get()[1],
static_cast<int>(j - l)) *
getObject().
get(k, l));
102 assert(i + j <= order);
105 "been computed, you should "
106 "specify a higher order.");
108 return values[j * (order + 1) + i];
117 for (
unsigned int k = 0; k < orderp1; k++) {
118 for (
unsigned int l = 0; l < orderp1 - k; l++) {
119 os <<
"mu[" << k <<
"," << l <<
"] = " << this->
get(k, l) <<
"\t";
134 os << (__FILE__) << std::endl;
144 bool found_moment_gravity;
147 if (!found_moment_gravity)
149 os <<
"Xg = " << momentGravity.
getXg() <<
"\t"
150 <<
"Yg = " << momentGravity.
getYg() << std::endl;
173 for (
unsigned int i = 0; i < m.
values.size(); i++) {
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)
const std::vector< double > & get() const
void compute() VP_OVERRIDE
void printWithIndices(std::ostream &os) const
friend VISP_EXPORT std::ostream & operator<<(std::ostream &os, const vpMomentCentered &v)
void printDependencies(std::ostream &os) const VP_OVERRIDE
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
const vpMomentObject & getObject() const
std::vector< double > values
vpMomentDatabase & getMoments() const
vpMoment(const vpMoment &)=delete