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

Face property propagation through SurfaceTriangulation #141

Open
ramcdona opened this issue Mar 8, 2023 · 6 comments
Open

Face property propagation through SurfaceTriangulation #141

ramcdona opened this issue Mar 8, 2023 · 6 comments

Comments

@ramcdona
Copy link

ramcdona commented Mar 8, 2023

I have a polygon mesh. I need to triangulate it to visualize with OpenGL. I am using SurfaceTriangulation to do this (I see the example visualization code has its own built-in visualization routine).

When the triangulation is complete, the 'new' triangles do not have the face_properties of the polygon they came from.

In this case, I have normal vectors stored in a face_property. When I triangulate the polygon mesh, I would expect the new triangles to inherit (copy) the face properties of their parent face. Sometimes this data will be correct (normal vector) -- other times it might not make sense (area).

I could potentially lookup the data, but I don't see any way to obtain the 'parent' face for all the new tris.

Obviously I can recalculate a normal vector, but in the near future I will also need to assign other properties like color etc.

Suggestions are appreciated.

@dsieger
Copy link
Member

dsieger commented Mar 9, 2023

This is currently not supported, marking it as enhancement.

@ramcdona
Copy link
Author

Thanks for the information. Is this something a user could try to take on? I'm very new to pmp-library, but this is pretty essential for me.

From a larger perspective, I think you're going to need to think through how to handle this in a lot of cases. One of the fundamental design elements of pmp-library is the ability to dynamically attach properties to each of the topological entities of a mesh.

What to do with those properties when the mesh topology changes is a pretty fundamental question -- and there are lots of times the topology changes.

A most flexible approach would be to provide hooks for the user to write functors that would assign new values to properties upon each operation. When faces are merged, perhaps properties are summed -- when they are split, perhaps properties are divided in proportion to area.

No idea how you would develop the API for this, but it is an interesting idea. Hopefully a simple solution for propagating values through triangulation won't have to wait for the cool end-all solution to this problem.

@ramcdona
Copy link
Author

What do you think of something like this?

https://github.com/ramcdona/pmp-library/tree/face_property_propagation

@dsieger
Copy link
Member

dsieger commented Mar 12, 2023

Interesting question. So far, we basically left property handling up to the algorithm implementation since that's were you can do meaningful decisions about what to do. I am not sure that adding hooks or some other API into the data structure is the right path. I don't think I would adopt anything like that without careful thought and benchmarking.

@ramcdona
Copy link
Author

I agree that you can't anticipate what everyone would want to do. Different properties reasonably need to be propagated in different ways (or not at all).

This is why I suggested a hook-based method. That way, someone using an algorithm would have the ability to specify the behavior they need.

Leaving it to the algorithm implementation means that anyone who needs something different done will need to re-implement the algorithm or edit the existing implementation. That takes away any benefit from having the algorithms in a library.

Don't change this on my accord, I'm just offering my observations.

My evaluation of PMP has been fun, but it looks like my project will need to go another direction. Thanks for your help this week and good luck with PMP.

@dsieger
Copy link
Member

dsieger commented Mar 13, 2023

Thanks for your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants