cpp_basic_examples/hello_depth_perception/src/main/jni/hello_depth_perception_app.cc
void OnPointCloudAvailable(void* /*context*/,
                           const TangoPointCloud* point_cloud) {
  // Number of points in the point cloud.
  float average_depth;

  // Calculate the average depth.
  average_depth = 0;
  // Each xyzc point has 4 coordinates.
  for (size_t i = 0; i < point_cloud->num_points; ++i) {
    average_depth += point_cloud->points[i][2];
  }
  if (point_cloud->num_points) {
    average_depth /= point_cloud->num_points;
  }

  // Log the number of points and average depth.
  LOGI("HelloDepthPerceptionApp: Point count: %d. Average depth (m): %.3f",
       point_cloud->num_points, average_depth);
}
// This function logs point cloud data from OnPointCloudAvailable callbacks.
//
// @param context, this will be a pointer to a HelloDepthPerceptionApp
//        instance on which to call callbacks. This parameter is hidden
//        since it is not used.
// @param *point_cloud, point cloud data to log.
This function logs point cloud data from OnPointCloudAvailable callbacks.
This function logs point cloud data from OnPointCloudAvailable callbacks .
void OnPointCloudAvailable(void* ,
                           const TangoPointCloud* point_cloud) {
  float average_depth;
  average_depth = 0;
  for (size_t i = 0; i < point_cloud->num_points; ++i) {
    average_depth += point_cloud->points[i][2];
  }
  if (point_cloud->num_points) {
    average_depth /= point_cloud->num_points;
  }
  LOGI("HelloDepthPerceptionApp: Point count: %d. Average depth (m): %.3f",
       point_cloud->num_points, average_depth);
}
void OnPointCloudAvailable ( void * , const TangoPointCloud * point_cloud ) { float average_depth ; average_depth = 0 ; for ( size_t i = 0 ; i < point_cloud -> num_points ; ++ i ) { average_depth += point_cloud -> points [ i ] [ 2 ] ; } if ( point_cloud -> num_points ) { average_depth /= point_cloud -> num_points ; } LOGI ( " " , point_cloud -> num_points , average_depth ) ; }
This function logs point cloud data from OnPointCloudAvailable callbacks.
This function logs point cloud data from OnPointCloudAvailable callbacks .
/*context*/ // Number of points in the point cloud. // Calculate the average depth. // Each xyzc point has 4 coordinates. // Log the number of points and average depth.