Cubic to equirectangular projection algorithm

后端 未结 5 1964

I have a cube map texture which defines a surrounding, however I need to pass it to a program which only works with latitude/longitude maps. I am really at lost here on how to d

5条回答
  •  广开言路
    2021-02-03 16:21

    I think from your algorithm in Python you might have inverted x and y in the calculation of theta and phi.

    def spherical_coordinates(x, y):
        return (math.pi*((y/h) - 0.5), 2*math.pi*x/(2*h), 1.0)
    

    from Paul Bourke's website here

    theta = x pi phi = y pi / 2

    and in your code you are using y in the theta calculation and x in the phi calculation.

    Correct me if I am wrong.

提交回复
热议问题