#### Calculating circumference of point cloud using convex hull

I have the following point cloud That’s the result that I need to be done.

I have a point cloud where I calculated using PCA the major axis of it, and I have a center point, it’s shown here after translating it marked as yellow. I would like to calculate a convex hull and its circumference.
I have tried to translate a the center point and create a displacement in X direction but the math is wrong.

``````std::vector<pcl::PointXYZ> convex_hull_pts;
unsigned long id = 0;
double eps = 0.03;
std::stringstream stream1;

for (size_t i = 0; i < 50; ++i) {
const pcl::PointXYZ& pt = orientedGolden->at(i);

pcl::PointXYZ pc;
pc.x = center.x - 0.2 - eps;
pc.z = center.z;
pc.y = center.y;
convex_hull_pts.push_back(pc);

viewer->addSphere(pc, 0.01, 255, 255, 0, stream1.str());

stream1 << id++;
}
pcl::PointCloud<pcl::PointXYZ>::Ptr convex_hull_cloud(new pcl::PointCloud<pcl::PointXYZ>);

for (auto& pt : convex_hull_pts)
{
convex_hull_cloud->points.push_back(pt);

}

ModelCoefficients::Ptr plane_coefficients(new ModelCoefficients());
plane_coefficients->values.resize(4);
plane_coefficients->values = 1;
plane_coefficients->values = 0;
plane_coefficients->values = 0;
plane_coefficients->values = 0;

/// Project segmented object points onto plane
ProjectInliers<PointXYZ> project_inliers_filter;
project_inliers_filter.setInputCloud(convex_hull_cloud);
project_inliers_filter.setModelType(SACMODEL_PLANE);
project_inliers_filter.setModelCoefficients(plane_coefficients);
PointCloud<PointXYZ>::Ptr convex_hull_projected(new PointCloud<PointXYZ>());
project_inliers_filter.filter(*convex_hull_projected);

ConvexHull<PointXYZ> convex_hull_2d;
convex_hull_2d.setInputCloud(convex_hull_projected);
pcl::PointCloud<pcl::PointXYZ>::Ptr  hull_2d(new pcl::PointCloud<pcl::PointXYZ>);
convex_hull_2d.reconstruct(*hull_2d);
std::cout << convex_hull_2d.getDimension();
``````

Source: Windows Questions C++