1 #ifndef SOPHUS_SIM_DETAILS_HPP 
    2 #define SOPHUS_SIM_DETAILS_HPP 
    9 template <
class Scalar, 
int N>
 
   11                            Scalar 
const theta, Scalar 
const sigma) {
 
   17   static Scalar 
const one(1);
 
   18   static Scalar 
const half(0.5);
 
   20   Scalar 
const scale = exp(sigma);
 
   28       Scalar theta_sq = theta * theta;
 
   29       A = (one - cos(theta)) / theta_sq;
 
   30       B = (theta - sin(theta)) / (theta_sq * theta);
 
   33     C = (scale - one) / sigma;
 
   35       Scalar sigma_sq = sigma * sigma;
 
   36       A = ((sigma - one) * scale + one) / sigma_sq;
 
   37       B = (scale * half * sigma_sq + scale - one - sigma * scale) /
 
   40       Scalar theta_sq = theta * theta;
 
   41       Scalar a = scale * sin(theta);
 
   42       Scalar b = scale * cos(theta);
 
   43       Scalar c = theta_sq + sigma * sigma;
 
   44       A = (a * sigma + (one - b) * theta) / (theta * c);
 
   45       B = (C - ((b - one) * sigma + a * theta) / (c)) * one / (theta_sq);
 
   48   return A * Omega + B * Omega2 + C * I;
 
   51 template <
class Scalar, 
int N>
 
   53                               Scalar 
const theta, Scalar 
const sigma,
 
   59   static Scalar 
const half(0.5);
 
   60   static Scalar 
const one(1);
 
   61   static Scalar 
const two(2);
 
   63   Scalar 
const scale_sq = scale * scale;
 
   64   Scalar 
const theta_sq = theta * theta;
 
   65   Scalar 
const sin_theta = sin(theta);
 
   66   Scalar 
const cos_theta = cos(theta);
 
   70     c = one - half * sigma;
 
   75       b = (theta * sin_theta + two * cos_theta - two) /
 
   76           (two * theta_sq * (cos_theta - one));
 
   79     Scalar 
const scale_cu = scale_sq * scale;
 
   80     c = sigma / (scale - one);
 
   82       a = (-sigma * scale + scale - one) / ((scale - one) * (scale - one));
 
   83       b = (scale_sq * sigma - two * scale_sq + scale * sigma + two * scale) /
 
   84           (two * scale_cu - Scalar(6) * scale_sq + Scalar(6) * scale - two);
 
   86       Scalar 
const s_sin_theta = scale * sin_theta;
 
   87       Scalar 
const s_cos_theta = scale * cos_theta;
 
   88       a = (theta * s_cos_theta - theta - sigma * s_sin_theta) /
 
   89           (theta * (scale_sq - two * s_cos_theta + one));
 
   91           (theta * s_sin_theta - theta * sin_theta + sigma * s_cos_theta -
 
   92            scale * sigma + sigma * cos_theta - sigma) /
 
   93           (theta_sq * (scale_cu - two * scale * s_cos_theta - scale_sq +
 
   94                        two * s_cos_theta + scale - one));
 
   97   return a * Omega + b * Omega2 + c * I;