mpetroff / pannellum

Pannellum is a lightweight, free, and open source panorama viewer for the web.
https://pannellum.org/
MIT License
4.28k stars 725 forks source link

cube faces not well aligned and wrong size #34

Closed luishcq closed 9 years ago

luishcq commented 9 years ago

Hi Matthew,

I'm experimenting with pannellum, and, despite the multiresolution example worked as it should, I can't manage to have my own multiresolution pano going OK. I modified generate.py in order to work with Python 2.7.9 (Debian testing "jessie"), but the issues here were about errors when trying to save files in directories already existing and math.ceil returning a float instead of int.

The problem with the panorama is: the cube faces do not join - sometimes some faces do join, but - I can see that the faces are not properly aligned.

I have pannellum 2.0.1.

Also I noticed that the config.json is always created with "extension": "jpg" ;)

thanks!

PS: Attached file shows the left (right side in picture), back (left in pic), top and bottom faces

problema no pano multires

luishcq commented 9 years ago

Just another pic where misalignments are evident problema no pano multires1

mpetroff commented 9 years ago

As you're not the first to try to convert generate.py to Python 2 and have issues, I just added Python 2.7 support to it. There are gaps in your panorama because none of the non-square tiles were generated. I ran into the same problem converting the script. It turns out Python 3 does more implicit conversions between integers and floats than Python 2, which I think is also why explicit integer casts are needed. Python 3 will output a float when two integers don't divide evenly, e.g. 3 / 2 = 1.5, while Python 2 does integer division, effectively flooring the result, e.g. 3 / 2 = 1. Therefore, some float casts needed to be added in; otherwise, the input to the ceiling function was floored first, so the ceiling function did nothing. If you grab the latest copy of generate.py, it should work properly in Python 2.

luishcq commented 9 years ago

Thank you very very much! It's working now, flawlessly! I'll proceed using/learning Pannellum - and perhaps Python too - and I think it could help me. I couldn't find any wishlist in Amazon, but I'm really grateful. Regards!