Hi,
Are you aware of
std::hypot
?
https://en.cppreference.com/w/cpp/numeric/math/hypot
What is the purpose of the function? We might be able to come up with a better solution if we knew what you actually want to do. This is an XY problem, we have your solution Y, but we don't know what X is.
BTW, I am an Engineering and Mining Surveyor, I deal with Point Clouds all the time.
Why does the inner for loop process distances to
all the items in v? That's O(n
2) right there. If you can find a way to do it in at least O(n) you would be down to millions rather than trillions.
There might be better data structures to store your data, I remember old software was slow with point clouds because it stored all the data in one giant array. One such data structure that could be better, (depending on what you are doing), is the Tile Structure which is a specialization of an R-Tree (Rectangular Tree). Basically if one can put data into smaller Tiles, then the look up is greatly reduced.
You might also benefit from decoupling PointXYZRGB into XYZ and RGB, do COGO with the XYZ, look up RGB when you need it.
What is the function supposed to produce? At the moment it produces nothing (apart from the trivial line 20), or was that the result of dumbing it down to ask the question?
It also seems odd that you are interested in points that are
further away than 10 metres. That seems backwards: point clouds typically have millions of points and can cover large areas, I have dealt with LIDAR data which covered 70km
2. Why have an interest in all points at the other end of the survey, from each of the points in the whole survey? More bizarre is that you truncate to the nearest metre because of the use of the integer type.
So in short, please supply a description of what it is you are doing exactly, so we can help you better :+)