cds-astro / cds-healpix-rust

The CDS HEALPix library in Rust (WebAssembly, Python, ...)
Apache License 2.0
16 stars 6 forks source link

Feature request: unproj (pix2ang) for gpu #9

Closed bmatthieu3 closed 4 months ago

bmatthieu3 commented 5 months ago

There is already a proj code that is adaptable for running on GPU and it works very well in Aladin Lite. It is used for getting the HEALPix index of a sky coo in order to retrieve the good tile texture image to plot for that sky coo.

Would it be possible to have the unproj method this time that would be adaptable for gpu too ? :)

My use case is the following: I would like to benefit the fact that HEALPix cell on the HEALPix space are simple squares to use GPU instancing ( https://en.wikipedia.org/wiki/Geometry_instancing ) to render many of them (e.g. many filled cells of a MOC). This could drastically reduce the size of the buffer sent to the GPU from 4 vertices*2 floats per cell to 2 floats encoding the center of the cell in the HPX space + 1 float encoding its size so 3 floats per cell instead of 8 floats. The only thing I am concerned with is that once I do the unproj to get the sky coo of my vertex then I will have to project it again in the aladin lite view projection (which could add some precision issues because the projection is done on a float and not a double). Nonetheless I would like to test it to see if this is working, I am pretty sure that if the precision is not so much of an issue then there could be very efficient to render many HEALPix cells.

fxpineau commented 4 months ago

Done in commit d209a61b46969db35081034806d0c3bed9496d33.