38 #include <opencv2/opencv.hpp> 
   43     double angle_step, 
double angle_min, 
double angle_max,
 
   44     double radius_step, 
double radius_min, 
double radius_max, 
int n_points):
 
   45     angle_step_(angle_step), angle_min_(angle_min), angle_max_(angle_max),
 
   46     radius_step_(radius_step), radius_min_(radius_min), radius_max_(radius_max),
 
   81     double& 
x, 
double& 
y, 
double& 
z)
 
   93     const double inc = CV_PI * (3 - 
sqrt(5));
 
   95     double y = 
index_ * off - 1.0f + (off / 2.0f);
 
   98     double x = std::cos(phi) * 
r;
 
   99     double z = std::sin(phi) * 
r;
 
  100     double lat = std::acos(
z), lon;
 
  101     if ((fabs(std::sin(lat)) < 1e-5) || (fabs(
y / std::sin(lat)) > 1))
 
  104       lon = std::asin(
y / std::sin(lat));
 
  109     cv::Vec3d 
T(
x, 
y, 
z);
 
  112     double x_up = 
radius_ * std::cos(lon) * std::sin(lat - 1e-5) - 
x;
 
  113     double y_up = 
radius_ * std::sin(lon) * std::sin(lat - 1e-5) - 
y;
 
  114     double z_up = 
radius_ * std::cos(lat - 1e-5) - 
z;
 
  118     double x_right = -y_up * 
z + z_up * 
y;
 
  119     double y_right = x_up * 
z - z_up * 
x;
 
  120     double z_right = -x_up * 
y + y_up * 
x;
 
  124     double x_new_up = x_up * std::cos(angle_rad) + x_right * std::sin(angle_rad);
 
  125     double y_new_up = y_up * std::cos(angle_rad) + y_right * std::sin(angle_rad);
 
  126     double z_new_up = z_up * std::cos(angle_rad) + z_right * std::sin(angle_rad);
 
  127     cv::Vec3d up(x_new_up, y_new_up, z_new_up);
 
  138     Eigen::Vector3f ez = Eigen::Vector3f(-T[0], -T[1], -T[2]).normalized();
 
  139     Eigen::Vector3f ey = Eigen::Vector3f(up[0], up[1], up[2]).normalized();
 
  140     Eigen::Vector3f 
ex = ey.cross(ez).normalized();
 
  141     Eigen::Vector3f translation = Eigen::Vector3f(T[0], T[1], T[2]);
 
  147     Eigen::Quaternionf 
q(mat);
 
  148     transform = Eigen::Translation3f(translation) * Eigen::AngleAxisf(q);