'How to get xyz information from computeVoxelAdjacencyGraph() in PCL?

I'm using the code below to make a graph from an octree, that will be used for path finding.

As I understand the adj_list.m_vertices contains pointers to the xyz data of octree centroids that I will be needing, but I can't figure out how to get to the xyz data.

The code:

#include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/octree/octree_pointcloud_adjacency.h>
#include <pcl/point_cloud.h>
#include <pcl/octree/octree_search.h>
#include <boost/graph/adjacency_matrix.hpp>
#include <vector>       
#include <set>
#include<iterator>

int
main ()
{

  srand ((unsigned int) time (NULL));

  pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);

  if (pcl::io::loadPCDFile<pcl::PointXYZ> ("test.pcd", *cloud) == -1) //* load the file
  {
    PCL_ERROR ("Couldn't read file pcd.pcd \n");
    return (-1);
  }
  
  

  float resolution = 0.0005f;

  pcl::octree::OctreePointCloudAdjacency<pcl::PointXYZ> octree (resolution);

  boost::adjacency_list<boost::setS, boost::setS, boost::undirectedS, pcl::PointXYZ, float> adj_list;


  octree.setInputCloud(cloud);
  octree.addPointsFromInputCloud();

  octree.computeVoxelAdjacencyGraph(adj_list);

  return (0);
}

I'm new to c++ so sorry if it is an obvious answer.

Thank you in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source