mirror of
https://github.com/introlab/rtabmap.git
synced 2026-09-01 17:10:26 +08:00
Tango: Added Rendering Options... -> Mesh Rendering -> Mesh Decimation
This commit is contained in:
@@ -137,6 +137,44 @@ std::list<std::list<int> > clusterPolygons(
|
||||
return clusters;
|
||||
}
|
||||
|
||||
std::vector<pcl::Vertices> organizedFastMesh(
|
||||
const pcl::PointCloud<pcl::PointXYZ>::Ptr & cloud,
|
||||
double angleTolerance,
|
||||
bool quad,
|
||||
int trianglePixelSize,
|
||||
const Eigen::Vector3f & viewpoint)
|
||||
{
|
||||
UDEBUG("size=%d angle=%f quad=%d triangleSize=%d", (int)cloud->size(), angleTolerance, quad?1:0, trianglePixelSize);
|
||||
UASSERT(cloud->is_dense == false);
|
||||
UASSERT(cloud->width > 1 && cloud->height > 1);
|
||||
|
||||
pcl::OrganizedFastMesh<pcl::PointXYZ> ofm;
|
||||
ofm.setTrianglePixelSize (trianglePixelSize);
|
||||
ofm.setTriangulationType (quad?pcl::OrganizedFastMesh<pcl::PointXYZ>::QUAD_MESH:pcl::OrganizedFastMesh<pcl::PointXYZ>::TRIANGLE_RIGHT_CUT);
|
||||
ofm.setInputCloud (cloud);
|
||||
ofm.setAngleTolerance(angleTolerance);
|
||||
ofm.setViewpoint(viewpoint);
|
||||
|
||||
std::vector<pcl::Vertices> vertices;
|
||||
ofm.reconstruct (vertices);
|
||||
|
||||
if(quad)
|
||||
{
|
||||
//flip all polygons (right handed)
|
||||
std::vector<pcl::Vertices> output(vertices.size());
|
||||
for(unsigned int i=0; i<vertices.size(); ++i)
|
||||
{
|
||||
output[i].vertices.resize(4);
|
||||
output[i].vertices[0] = vertices[i].vertices[0];
|
||||
output[i].vertices[3] = vertices[i].vertices[1];
|
||||
output[i].vertices[2] = vertices[i].vertices[2];
|
||||
output[i].vertices[1] = vertices[i].vertices[3];
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
return vertices;
|
||||
}
|
||||
std::vector<pcl::Vertices> organizedFastMesh(
|
||||
const pcl::PointCloud<pcl::PointXYZRGB>::Ptr & cloud,
|
||||
double angleTolerance,
|
||||
|
||||
Reference in New Issue
Block a user