2016-05-16 23:40 GMT+02:00 Rakshika Bagavathy <rakshika.bagava...@gmail.com>: > Daniel, > >> >> Ooh, generic container doesn't mean generic programming. In fact, it >> would be explicitly a non-generic programming. (Do you know why?) > > I'm sorry, I'm not following what you mean.
How could the “type to be specified later” programming paradigm be used in a mesh healing algorithm: (BTW, everything is pseudo code here, i.e. don't take the names etc. too literally.) A mesh healing algorithm operates on a mesh structure. It's central, so let's declare it: struct polygonal_mesh; This is a so called forward declaration. It says that there is a data type called polygonal_mesh but it doesn't define it. Especially it doesn't specify it's memory consumption. What's the value of it? How can we work with something where we don't even know its size? Well, we can have functions which have this structure as a parameter: int number_of_faces(polygonal_mesh* mesh); int[3] get_face(polygonal_mesh* mesh, int faceIndex); double[3] get_vertex(polygonal_mesh* mesh, int vertexId); int add_vertex(polygonal_mesh* mesh, double[3] coordinate); int add_face(polygonal_mesh* mesh, int[3] vertexIds); void remove_face(polygonal_mesh* mesh, int faceIndex); Having this we can program and compile a mesh healing algorithm. All without defining what polygonal_mesh in fact is. However, it's obvious that at some point we have to define it and implement the functions. But this is hopefully much easier than implementing full featured converters. In case of BRL-CAD you would need a file polygonalmesh.cpp (BTW, the above declarations could be the content of a file polygonalmesh.h) with the following content: struct polygonal_mesh { rt_bot_internal* bot; }; int number_of_faces(polygonal_mesh* mesh) { return mesh->bot->num_faces; } int[3] get_face(polygonal_mesh* mesh, int faceIndex) { int ret[3]; ret[0] = return mesh->bot->faces[m_faceIndex * 3]; ret[1] = return mesh->bot->faces[m_faceIndex * 3 + 1]; ret[2] = return mesh->bot->faces[m_faceIndex * 3 + 2]; return ret; } …. For OpenSCAD we would need a similar polygonalmesh.cpp with an interface to its Polyset. For any other CAD or modeler it's the same: If the interface (polygonalmesh.cpp) could be implemented it can use your mesh healing algorithm. That's it: If the algorithm is written the polygonal_mesh type can be specified later on. Regards, Daniel ------------------------------------------------------------------------------ Mobile security can be enabling, not merely restricting. Employees who bring their own devices (BYOD) to work are irked by the imposition of MDM restrictions. Mobile Device Manager Plus allows you to control only the apps on BYO-devices by containerizing them, leaving personal data untouched! https://ad.doubleclick.net/ddm/clk/304595813;131938128;j _______________________________________________ BRL-CAD Developer mailing list brlcad-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-devel