// Initialize to 0 centroid.setZero (); // For each point in the cloud // If the data is dense, we don't need to check for NaN if (cloud.is_dense) { for (constauto& point: cloud) { centroid[0] += point.x; centroid[1] += point.y; centroid[2] += point.z; } centroid /= static_cast<Scalar> (cloud.size ()); centroid[3] = 1; return (static_cast<unsignedint> (cloud.size ())); }
// NaN or Inf values could exist => check for them unsigned cp = 0; for (constauto& point: cloud) { // Check if the point is invalid if (!isFinite (point)) continue;
// Initialize to 0 centroid.setZero (); // If the data is dense, we don't need to check for NaN if (cloud.is_dense) { for (constint& index : indices) { centroid[0] += cloud[index].x; centroid[1] += cloud[index].y; centroid[2] += cloud[index].z; } centroid /= static_cast<Scalar> (indices.size ()); centroid[3] = 1; return (static_cast<unsignedint> (indices.size ())); }
// NaN or Inf values could exist => check for them unsigned cp = 0; for (constint& index : indices) { // Check if the point is invalid if (!isFinite (cloud [index])) continue;