Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic tree constructor can't handle non-empty cloud #72

Closed
jefesaurus opened this issue Feb 15, 2018 · 3 comments
Closed

Dynamic tree constructor can't handle non-empty cloud #72

jefesaurus opened this issue Feb 15, 2018 · 3 comments

Comments

@jefesaurus
Copy link
Contributor

Here's the existing constructor.

		KDTreeSingleIndexDynamicAdaptor(const int dimensionality, DatasetAdaptor& inputData, const KDTreeSingleIndexAdaptorParams& params = KDTreeSingleIndexAdaptorParams() , const size_t maximumPointCount = 1000000000U) :
			dataset(inputData), index_params(params), distance(inputData)
		{
			if (dataset.kdtree_get_point_count()) throw std::runtime_error("[nanoflann] cannot handle non empty point cloud.");
			treeCount = std::log2(maximumPointCount);
			pointCount = 0U;
			dim = dimensionality;
			treeIndex.clear();
			if (DIM > 0) dim = DIM;
			m_leaf_max_size = params.leaf_max_size;
			init();
		}

Would there be anything wrong with removing the assertion and then adding a line:
addPoints(0, dataset.kdtree_get_point_count() - 1);
right after init?
This seems more intuitive.

@jefesaurus jefesaurus changed the title Dynamic tree constructor can't handle empty cloud Dynamic tree constructor can't handle non-empty cloud Feb 15, 2018
@jefesaurus
Copy link
Contributor Author

Also, another question, is there a reason the input cloud's reference is non-const?

@jefesaurus
Copy link
Contributor Author

Seems to work? #73

@jlblancoc
Copy link
Owner

👍 This one is covered by #73, so I think we can close it.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants