After outlining the methods for the portable module, the decision left to take was which one to go with. I decided to go with the Daniel’s method of using an abstract class to represent the intermediate polygonal structure, which will access the native mesh types to obtain any information. This was because the method I suggested will tend to clutter things, and will unnecessarily complicate things. A problem arose due to the difference between the two organisation’s format of representation. BRL-CAD uses an indexed format, while OpenSCAD uses an unindexed format.
If there is no need for the intermediate mesh to store the vertices in an indexed format, then the issue is trivial. That is, if the only task of the intermediate polygonal structure is to be able to convert to the doubly-connected edge list (that we will use for the algorithms) smoothly, the abstract classes method can be used. This cannot be answered now. Once i write the draft algorithms, things will pan out a bit more.
So primarily, for storing the geometry we are using the abstract class and for processing we are using the doubly-connected edge list.
What essentially happens on both softwares is we fire up the command/invoke the functionality from the GUI. This links up to the conversion file specific to the softwares. The intermediate polygonal_mesh abstract class is just a container for the native mesh types. This class will have virtual methods that will be implemented specific to the two softwares. Now, with the intermediate container set, we create the DCEL with the help of the virtual functions. With the help of the DCEL, we implement the healing algorithms.
After the process is done, we’ll recalculate the normals for the BRL-CAD mesh since it includes this attribute information in its structure. No post-processing is required for the PolySet class in OpenSCAD.
The vertex, edge and face records for the DCEL have been defined. The functions required for obtaining/adding/removing information will be defined as and when we require them while implementing the healing algorithms.
PolygonalMesh abstract class:
We won’t need any attributes, since we won’t be caching any information. The DCEL will do that job. As for functions, for now we define those functions that we will need for converting the PolygonalMesh object to the doubly-connected edge list object. Later on we will add functions that we will use to add/remove information from the native structures, depending on the situations. Suppose we need to add a vertex, we would be requires to know if it’s a part of a face/a stand-alone vertex that we will create a face for next.
When we modify the structure of the mesh i.e. add/remove any information, we’ll do it simultaneously for both the structures because we don’t want to be converting from the DCEL to the PolygonalMesh intermediate class.