# Revision history [back]

### Does octomap calcNumNodes() give toatal number of occupied+free voxels?

Hello i am working with ros octomap library. Octomap function calcNumNodes() returns with size. Function is defined like this:

octomap::OcTreeBaseImpl< NODE, I >::calcNumNodes() const


Traverses the tree to calculate the total number of nodes.

Does it mean this return total number of occupied + free voxels?

Actually i want to find how many voxels has been explored in a cubic volume and i am using this function but from the numbers i feel like its much lesser than how many there should be.

For an alternate there can be a way that i iterate all over the occupied and free voxels and count them, but should i be doing that or not? Pls enlighten me if there is better alternate?

Thanks.

### Does octomap calcNumNodes() give toatal number of occupied+free voxels?

Hello i am working with ros octomap library. Octomap function calcNumNodes() returns with size. Function is defined like this:

octomap::OcTreeBaseImpl< NODE, I >::calcNumNodes() const


Traverses the tree to calculate the total number of nodes.

Does it mean this return total number of occupied + free voxels?

Actually i want to find how many voxels has been explored in a cubic volume and i am using this function but from the numbers i feel like its much lesser than how many there should be.

For an alternate there can be a way that i iterate all over the occupied and free voxels and count them, but should i be doing that or not? Pls enlighten me if there is better alternate?