-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Fast and flexible mesh generation #11
base: master
Are you sure you want to change the base?
Conversation
By the way,
So there will be less copy needed for the |
I think this is a really nice contribution and valid approach to use raw buffers for this and then convert to halfedge mesh :) My main concern is that it is not really a part of this library since it is a completely new struct with new functionality only linked to Mesh by a conversion function. So my suggestion is to make the functionality use the Mesh struct, so all input/output is a Mesh (it really is a triangle mesh). Internally, this functionality could then use the raw arrays of vertices and triangles instead of the halfedge data structure (connectivity_info) and then convert at the end. A simple practical solution could be to use the builder pattern also used in MeshBuilder. It could maybe even be a part of MeshBuilder. What do you think? I was also thinking, it might be a good idea to be able to represent a mesh with different data structures internally and then convert to use the most suited for a specific operation. But this is a major change, so let's wait a bit with that :) Other minor stuff:
Again, I think this is really nice and very useful functionality! Thanks for your effort :) |
Thanks for your feedback !
Yes for sure ... I think that it could be usefull to propose to the team of
Oops, that was a mistake, I corrected it. If you come to other things like that, warn me !
I was considering implementing all the methods on a For the concern of exposing the struct's internal, I did that because at contrary to the Mesh that has haflfedge data that must not be corrupted, we have there only unchecked buffers of faces and points, so it seems to me that it could be the messy place, whereas Mesh is the clean one. I mean, at this point, when we are generating a mesh, we can generate a mesh that would be invalid thanks to Mesh just by using the methods of Shape, but that's when we convert it to a Mesh that we would do all the checks.
That's right ! But maybe it could be not as big at it seems: there is no need to use a specific |
Maybe we should merge Surely a |
I have to disagree, the internal functionality can be (a bit) messy, that is fine, but the interface should not! If the user wants to hack away at raw buffers, there is nothing stopping them, they can do so and then construct a mesh from raw buffers. Don’t get me wrong, I think the functionality is great and very well suited for tri-mesh, but as it is now, the functionality is not integrated and does not follow the same standards.
I think that sounds like a really big task since you have to implement all algorithms for all mesh types. Also, it goes against my principle of keeping stuff explicit as much as possible. Making things generic that does not need to be will always cause trouble. I think it was a bad idea from my side :)
I definitely think MeshBuilder and Shape are very similar, the only difference as I see it is that the generation functionality can take an existing mesh as input also? And that can maybe be solved by generating a new mesh and then merging the existing and the new mesh. If you can merge the generation functionality into mesh builder and make a clean interface, then I will be happy to merge. |
That's right, but just to be sure:
I'm not sure of how to to this in a smart way:
So maybe I misunderstood:
Do you mean calling mymesh.merge_with( MeshBuilder::new().generation_method(/* ... */).build().unwrap() ) each time we want to generate a portion of the mesh ? |
…x multiple times), added remove_unused
What do you think of this more checked and safe implementation: jimy-byerley@e56cda1 |
My point is that there is no need to add "hacking into raw buffers"-functionality to tri-mesh. You can already hack away at raw buffers and call a mesh builder with those buffers and create a Mesh. Why do you want to add hacky functionality to tri-mesh?
A simple example:
No, not at all. Right now it can only make one mesh at a time, but there is no reason why it shouldn't be able to add several meshes like:
Yes exactly. Or if you don't want to merge them, you can call |
This is a proposal for mesh generation routines.
As generation is often faster with raw triangle buffers, I thought it was better to generate the mesh using buffers and then convert in into
Mesh
Features
Shape
- as there no special restrictions on the geometry and there is no connectivity info - to handle these position and face buffersInto<Mesh>
for conversionNote:
I can't find a way to declare the constructor and the methods such that we can do
as well as
I always have an issue with data ownership.