本文整理汇总了C++中Jacobian::value方法的典型用法代码示例。如果您正苦于以下问题:C++ Jacobian::value方法的具体用法?C++ Jacobian::value怎么用?C++ Jacobian::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jacobian
的用法示例。
在下文中一共展示了Jacobian::value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetEulerZYX
/**
* \brief funcion to set the euler zyx angles.
* \param gamma input parameter that contains the amount of rotation around X.
* \param beta input parameter that contains the amount of rotation around Y.
* \param alpha output parameter that contains the amount of rotation around Z.
* \param JR output parameter that will contain the Rotation and Jacobian with the rotational velocities.
*/
void SetEulerZYX(const Jacobian<double>& gamma,
const Jacobian<double>& beta,
const Jacobian<double>& alpha,
Jacobian<Rotation>& JR) {
// position-domain :
JR.value() = Rotation::EulerZYX(alpha.value(),beta.value(),gamma.value());
double ca = ::cos(alpha.value());
double sa = ::sin(alpha.value());
double cb = ::cos(beta.value());
double sb = ::sin(beta.value());
// velocity-domain :
assert(gamma.nrOfDeriv()==JR.nrOfDeriv());
assert(beta.nrOfDeriv()==JR.nrOfDeriv());
assert(alpha.nrOfDeriv()==JR.nrOfDeriv());
for (int i=0;i<gamma.nrOfDeriv();++i) {
if (gamma.hasDeriv(i) || beta.hasDeriv(i) || alpha.hasDeriv(i) ) {
Vector w;
double dalpha = alpha.deriv(i);
double dbeta = beta.deriv(i);
double dgamma = gamma.deriv(i);
w[0] = -sa*dbeta + ca*cb*dgamma;
w[1] = ca*dbeta + sa*cb*dgamma;
w[2] = dalpha - sb*dgamma;
JR.deriv(i) = w;
} else {
JR.setDeriv(i,false);
}
}
}
示例2: GetEulerZYX
/**
* \brief function to get the euler zyx angles.
* \param JR input parameter that indicates the Rotation and Jacobian with the rotational velocities.
* \param gamma output parameter will contain the amount of rotation around X.
* \param beta output parameter will contain the amount of rotation around Y.
* \param alpha output parameter will contain the amount of rotation around Z.
* \retval 0 if successfull, otherwise its a singular situation.
*/
int GetEulerZYX(const Jacobian<Rotation>& JR,
Jacobian<double>& gamma,
Jacobian<double>& beta,
Jacobian<double>& alpha,
double eps) {
// position-domain :
JR.value().GetEulerZYX(alpha.value(),beta.value(),gamma.value());
double ca = ::cos(alpha.value());
double sa = ::sin(alpha.value());
double cb = ::cos(beta.value());
double sb = ::sin(beta.value());
// velocity-domain :
assert(gamma.nrOfDeriv()==JR.nrOfDeriv());
assert(beta.nrOfDeriv()==JR.nrOfDeriv());
assert(alpha.nrOfDeriv()==JR.nrOfDeriv());
for (int i=0;i<JR.nrOfDeriv();++i) {
if (JR.hasDeriv(i) ) {
Vector w = JR.deriv(i);
double dgamma = (ca*w[0]+sa*w[1]);
if (fabs(cb) < eps) {
if (fabs(dgamma)< eps) {
dgamma = 0.0; // arbitrary choice
} else {
return 1;
}
} else {
dgamma /= cb;
}
double dalpha = w[2] + sb*dgamma;
double dbeta = -sa*w[0]+ca*w[1];
gamma.deriv(i)=dgamma;
alpha.deriv(i)=dalpha;
beta.deriv(i) =dbeta;
} else {
gamma.setDeriv(i,false);
beta.setDeriv(i,false);
alpha.setDeriv(i,false);
}
}
return 0;
}