SurfaceMesh.h

Go to the documentation of this file.
00001 #ifndef __SURFACE_MESH_H
00002 #define __SURFACE_MESH_H
00003 
00004 /*
00005  * Polygonal mesh of the Surface geometry. Alhough the PolygonalMesh
00006  * is general, its too slow for purposes of the Surface geometry.
00007  * Because the Surface geometry has a lot of features of polygonal mesh
00008  * then we rather define this special mesh which behaves as an adaper
00009  * of the Surface geometry.
00010  *
00011  * Features:
00012  *    1) Much more faster creation than PolygonalMesh
00013  *    2) Fast per-polygon inspection
00014  *    3) Slower per-edge and per-vertex walks in comparison
00015  *       with PolygonalMesh due to duplicities
00016  *    4) Does not support neither vertex nor plane IDs i.e. getActVertID()
00017  *       and getActPlaneID() methods and their variations
00018  */
00019 
00020 #include <esg/mesh/Mesh.h>
00021 #include <esg/geometry/Surface.h>
00022 #include <esg/geometry/_Surface.h>
00023 
00024 namespace esg {
00025 
00026 class SurfaceMesh : public Mesh {
00027 protected:
00028     Surface        * _pSurface;
00029     const _Surface * _pSurf;
00030     unsigned         _actVertIndex;
00031     
00032 public:
00033     SurfaceMesh (Surface * pS)
00034         : _pSurface(pS), _pSurf(NULL), _actVertIndex(0) { pActPlane = NULL; }
00035     
00036     virtual ~SurfaceMesh () { if (pActPlane) delete pActPlane; }
00037 
00038     virtual void rotate    (const Matrix3&);
00039     virtual void translate (const Vector3&);
00040     virtual void transform (const Matrix4&);
00041     virtual void scale     (float, float, float);
00042     
00043     virtual void     resetActSolid() {}
00044     virtual int      goToNextSolid() { return 0; }
00045     virtual void     resetActPlane();
00046     virtual Plane*   getActPlane();
00047     virtual int      goToNextPlane();
00048     virtual void     resetActEdge();
00049     virtual int      goToNextEdge();
00050 
00051     // the bool parameter desides if the edge is properly re-oriented
00052     // before vertex inspection. When set to true then actual plane
00053     // must be set.
00054     virtual Vertex3  getActVert1(bool); // first vertex of actual edge
00055     virtual Vertex3  getActVert2(bool); // second vertex of actual edge
00056     virtual Vertex3  getActVert();      // actual vertex
00057     virtual Vertex3  getActVertNormal1(bool);
00058     virtual Vertex3  getActVertNormal2(bool);
00059     virtual Vertex3  getActVertNormal();
00060 
00061     virtual int getActVertID1(bool) { return -1; }
00062     virtual int getActVertID2(bool) { return -1; }
00063     virtual int getActVertID()      { return -1; }
00064 
00065     virtual int     getActPlaneID() { return -1; }
00066     virtual Vertex3 getActPlaneNormal() const;
00067     virtual Vector3 getActPlaneCentroid();
00068     //virtual double  getActPlaneArea(); // inherited
00069     
00070     virtual void resetEdgeWalkInSolid();
00071     virtual int  stepInEdgeWalkInSolid();
00072 
00073     virtual void resetVertWalkInSolid();
00074     virtual bool stepInVertWalkInSolid();
00075 
00076     virtual int numberOfVertices (void) const;
00077     virtual int numberOfEdges    (void) const;
00078 
00079     virtual bool hasOutwardNormals (void) const { return true; }
00080 
00081     virtual void turnInsideOut (void); // invert normals
00082 };
00083     
00084 }; // namespace
00085 
00086 #endif // __SURFACE_MESH_H

Generated on Wed Jun 28 12:24:28 2006 for esg by  doxygen 1.4.6