How to reorder .xyz file?

Working on bathymetry files for real time ocean floor representation, I want to now if its possible to remap the pixel in a .xyz file to have a mapping between pixel position in image (u-v) and the point position (x-z). I need it to make some calculations about normals or collisions.
I know it can be time demanding (around 4 millions points) but I have to do it once.
Thank you for your help.

Finally, I found a solution. Using analyse Top, I can know the min and max for x and reading the file in Sublime Text, I can calculate width and height of the map in pixel. What I discover is, in pointfilein Top, if I don’t accept “use input” but fix the resolution to the found numbers of x and y, the pixel are well placed. Like that, I can crop the point cloud accordingly and navigate a map of 10 millions point, only moving what I see in the camera.

I will make a tutorial about the process but the possibilities are huge. But perhaps it would be interesting to allow the point file in Top to automatically find the size of the map (if that’s a map) and choose the right dimensions instead of searching the square root to decide the size.

Glad you found a solution. For reference, the pointRepack component in the palette can do the same remapping work on existing textures as the Point File In does on load.

The Point File In can pick a specific size for the output texture when the file format supports it (I believe it does use the dimensions in FITS files), but other formats just pack the points into a square texture for convenience.

Would be interesting to know how common it is for point files to be packed in a way that the pixels can be arranged in a way that matches the position. I have worked with hgt elevation maps in the past that could work that way.

Glad to hear you. With my point file coming from geographic database and application (qGis, free), I can now crop the big map ( 9000 x 9000 pixels) to only use 1000 x 1000 for instancing particles, so I can follow the camera with the crop. Its also possible to reduce the resolution without artefact and with it I can easily calculate the height between a mobile and the map.
Also I can more easily use compute shader, because I have directly the pixel coordinate, without the necessity to multiply uv by res with the problems of interpolation.
pointRepack doesn’t do the same job, if the point file, as in .xyz is just a list of coordinate, he doesn’t reorder it properly.