The Wayback Machine - https://web.archive.org/web/20201026170846/https://github.com/RandyGaul/cute_headers/issues/134
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

Suggestion for cute_spheremesh - Smooth Mesh Support #134

Closed
irlanrobson opened this issue Apr 19, 2019 · 4 comments
Closed

Suggestion for cute_spheremesh - Smooth Mesh Support #134

irlanrobson opened this issue Apr 19, 2019 · 4 comments

Comments

@irlanrobson
Copy link

@irlanrobson irlanrobson commented Apr 19, 2019

Hi Randy.

I think it would be nice for an user to have a sphere mesh which contains a list of unique vertices and a list of triangle indices. It seems that you're duplicating vertices by simple adding each vertex of a subdivided edge to the mesh. Of course this is not a problem since the output is a list of triangle vertices.

Creating unique vertices can be done by keeping a map of subdivided edge to vertex. When you subdivide an edge you either add a new vertex or use a vertex from the map. More specifically if the opposite edge of an edge is on the map you use the associated vertex to create the new triangle. Otherwise you create a new vertex and add the edge-vertex pair to the map.

Here is some working code to boost up implementation if you ever want to try this.

HTH.

@RandyGaul
Copy link
Owner

@RandyGaul RandyGaul commented Apr 19, 2019

Hi Irlan, thanks for the suggestion! It is a good suggestion. I’m not doing any sphere stuff lately so I wouldn’t be making this change until it became necessary. But if anyone posts up a PR I’ll gladly merge it in :)

@RandyGaul RandyGaul changed the title Suggestion Suggestion for cute_spheremesh - Smooth Mesh Support Apr 19, 2019
@irlanrobson
Copy link
Author

@irlanrobson irlanrobson commented Apr 20, 2019

Just let you know I optimized the code above. Now it performs a single memory allocation. I also uses C-style notation. Maybe you can just implement your version based on this.

Note there might be a nice formula which gives the number of unique vertices in the final sphere mesh. I use the maximum number of vertices at the moment which works gracefully.

@RandyGaul
Copy link
Owner

@RandyGaul RandyGaul commented Apr 20, 2019

The more optimized the more a pull request is appreciated :)

@RandyGaul
Copy link
Owner

@RandyGaul RandyGaul commented Dec 30, 2019

Just pruning old issues

@RandyGaul RandyGaul closed this Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants
You can’t perform that action at this time.