Skip to content

Commit

Permalink
Add PointNormalPointCloud specialization to ofxPCL::convert
Browse files Browse the repository at this point in the history
  • Loading branch information
satoruhiga committed Jul 7, 2012
1 parent b743bcc commit fc96308
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Utility.h
Expand Up @@ -46,6 +46,25 @@ inline void convert(const ColorPointCloud& cloud, ofMesh& mesh)
mesh.setVertex(i, ofVec3f(p.x, p.y, p.z));
}
}

template <>
inline void convert(const PointNormalPointCloud& cloud, ofMesh& mesh)
{
assert(cloud);

float inv_byte = 1. / 255.;
const size_t num_point = cloud->points.size();

if (mesh.getNumVertices() != num_point) mesh.getVertices().resize(num_point);
if (mesh.getNumNormals() != num_point) mesh.getNormals().resize(num_point);

for (int i = 0; i < num_point; i++)
{
PointNormalType &p = cloud->points[i];
mesh.setNormal(i, ofVec3f(p.normal_x, p.normal_y, p.normal_z));
mesh.setVertex(i, ofVec3f(p.x, p.y, p.z));
}
}

template <>
inline void convert(const ColorNormalPointCloud& cloud, ofMesh& mesh)
Expand Down

0 comments on commit fc96308

Please sign in to comment.