KristofferC / NearestNeighbors.jl

High performance nearest neighbor data structures (KDTree and BallTree) and algorithms for Julia.
Other
425 stars 66 forks source link

Bounding box #120

Closed rvignolo closed 3 years ago

rvignolo commented 3 years ago

Hi @KristofferC

First of all, great package!

I just wanted to ask you if there is a way to get the bounding box of a mesh when or after building a KDTree. This would just mean if it is possible to retrieve or compute the point with the maximum coordinates (xmax, ymax, zmax, etc) and a point with the minimum coordinates (xmin, ymin, zmin, etc).

I am loading unstructured meshes (see this kind of meshes) as KDTrees and it would be great if I could get the bounding box when doing so (or compute it after). However, computing it afterwards would be similar to check all the nodes that I pass to the KDTree constructor and select the maximum or minimum value for each coordinate.

Thanks!

KristofferC commented 3 years ago

I guess you could call knn on the tree with six points, each with very large (positive and negative)x, y and z values.

But just looping through the points should be quite fast and probably won't be a bottle neck in a real application.

rvignolo commented 3 years ago

exactly, it is not a bottle neck. I just wanted to check if this was a feature or something implemented under the hood. Thank you very much!