2016-03-31 19:15 GMT+02:00 Rakshika Bagavathy <[email protected]>:
...
> I now understand that the base class has the polygonal_mesh structure and we
> work with that, but just implement the structure differently for both the
> derived classes. Did i understand it right?
I don't think so.
The Adapter is a design pattern in the object oriented software
development. (BTW, you can develop object oriented in C as well.)
There many design decisions are behavior driven. In our case this
means to ask: How should polygonal_mesh behave?
For example (only "pseudocode"):
class polygonal_mesh {
virtual int NumberOfFaces(void) = 0;
virtual int[3] GetFace(int) = 0;
virtual double[3] GetVertex(int) = 0;
virtual int AddVertex(double[3]) = 0;
virtual int AddFace(int[3]) = 0;
virtual RemoveFace(int) = 0;
};
Notice that there is no data in polygonal_mesh.
As the functions are pure virtual (= 0) there cannot be created an
instance of this class. To do this we have to derive, e.g.:
class brlcad_bot_polygonal_mesh : public polygonal_mesh {
// implement the virtual functions here
virtual int NumberOfFaces(void) {
return m_data->num_faces;
}
....
rt_bot_internal* m_data;
}:
I.e. your algorithm would use polygonal_mesh and you would have to
provide the classes brlcad_bot_polygonal_mesh,
openscad_polyset_polygonal_mesh, and maybe brlcad_nmg_polygonal_mesh
to adapt the different polygonal meshes to your algorithm.
However, this is only a raw overview of how the adapter pattern could
be used here. To get a full design some more work is necessary.
Regards,
Daniel
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
BRL-CAD Developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-devel