[SOLVED] Equirectangular to Rectilinear projection and vice versa

Hello , I want to convert equirectangular image to rectilinear HTML canvas core api.( Using per pixel manipulation, not webgl shaders )
I downloaded an equirectangular image like the following:


Then I want to convert it as per following:
sample_nfov
sample_nfov2
I came up with a thread Rectilinear projection of Equirectangular image
Ref : Gnomonic Projection
PDF : result.pdf (288.9 KB)
How can I implement this using canvas api (per pixel manipulation) ?
NOTE: I already converted cubemap to equirectangular image and vice versa.
Cubemap: ThreeJS_Park2
Equirectangular:
But I want rectilinear image from this. Pls help.

You should map equirectangular projection on sphere and then back to plane with gnomic projection. Just type all the math that you found without thinking and try to see what you get.

But why canvas api? :thinking:

Anyway, I managed to get a work around by cropping the cubemap. Actually I was looking for the algorithm to do it in java not in js.