Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for color PLY format #412

Closed
ghutchis opened this issue Nov 16, 2018 · 5 comments · Fixed by #1177
Closed

Support for color PLY format #412

ghutchis opened this issue Nov 16, 2018 · 5 comments · Fixed by #1177

Comments

@ghutchis
Copy link
Member

While Avo2 currently supports writing to POV-Ray and VRML formats, it would be great to support writing to the more common PLY format:

http://paulbourke.net/dataformats/ply/

The key component would be to enable writing spheres and cylinders as vertex / face meshes rather than a sphere or cylinder primitive.

@spotenza2016
Copy link
Contributor

Hi,
I'm new to open source and I'm looking to make my first contribution. Would it be okay if I start working on adding this feature?

@ghutchis
Copy link
Member Author

Yes, absolutely!

Take a look at VRMLVisitor (https://github.com/OpenChemistry/avogadrolibs/blob/master/avogadro/rendering/vrmlvisitor.cpp)

And then the "extension" part that adds a command is here: https://github.com/OpenChemistry/avogadrolibs/tree/master/avogadro/qtplugins/vrml

@spotenza2016
Copy link
Contributor

For spheres, I've found a couple of different methods for how they could be written as meshes. Obviously no methods will be 100% accurate, so I'm wondering what you all think the best option would be since I don't have the context of the rest of the project. I found this great website that gives visual demonstrations of the different types (https://www.danielsieger.com/blog/2021/03/27/generating-spheres.html), I'm thinking either the UV or the Icosphere?

For cylinders, it's similar with multiple methods that can be used, although each method is more similar. Essentially the circumference of the cylinder is just divided into equal latitudes, and the top/bottom faces are either implemented radially or connecting the edges.

I also can just implement multiple of these methods and just have a different visitor variable that chooses the methods/division amount/etc.

@ghutchis
Copy link
Member Author

For spheres, in Avo1 we used the icosphere (e.g., https://github.com/cryos/avogadro/blob/master/libavogadro/src/sphere_p.cpp)

I've also seen use of the Fibonacci sphere method (e.g., in Python)
https://stackoverflow.com/a/26127012/131896

I think either the icosphere or Fibonacci sphere would produce good results.

I would suggest implementing one method first (maybe icosphere) and then if everything is working, you can add the visitor options for other methods.

For what it's worth, the cylinder code for Avo1 is here:
https://github.com/cryos/avogadro/blob/master/libavogadro/src/cylinder_p.cpp

@spotenza2016
Copy link
Contributor

I have created a pull request with the completed functionality at #1177. I tested the build with these changes and it all seems to work!

@ghutchis ghutchis linked a pull request Oct 1, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants