PolygonalMesh.h

Go to the documentation of this file.
00001 #ifndef __POLYGONAL_MESH_H
00002 #define __POLYGONAL_MESH_H
00003 
00004 #include <esg/mesh/Mesh.h>
00005 
00006 /*
00007  * Precise polygonal mesh. Precise in the sense of minimal number of vertices
00008  * and edges (they are shared by facets).
00009  * 
00010  * Restrictions:
00011  *   1) Edge loops of all facets must be oriented by the same way
00012  *      (e.g. all counter-clockwise, this is preffered)
00013  *   2) Perfect topology but very slow! - see FastSurfaceMesh
00014  *
00015  */
00016 
00017 namespace esg {
00018 
00019     //class OGSCENE_EXPORT PolygonalMesh;
00020 
00021 class OGSCENE_EXPORT PolygonalMesh : public Mesh {
00022 protected:
00023      Sgi::hash_map<int,      Vert*> _vertices;
00024      Sgi::hash_map<long int, Edge*> _edges;
00025 
00026     static const unsigned MAX_LOOP; // to protect infinite cycles in code
00027     
00028 protected:
00029     inline Mesh::Vert*  _find_vertex        (int);
00030            void         _store_vertex       (Mesh::Vert*);
00031            Vector3      _plane_normal       (const unsigned[], 
00032                                              unsigned, unsigned, unsigned);
00033            long int     _multiplex          (unsigned, unsigned);
00034     inline Mesh::Edge*  _find_edge          (unsigned, unsigned);
00035     inline void         _store_edge         (Edge*);
00036     inline void         _erase_edge         (unsigned, unsigned);
00037            Mesh::Edge*  _append_new_edge    (Mesh::Vert*,
00038                                              Mesh::Vert*,
00039                                              Mesh::Plane*);
00040            Mesh::Edge*  _append_fake_edge   (Mesh::Edge*, Mesh::Vert*);
00041            bool         _connect_edge       (Mesh::Edge*, Mesh::Plane*);
00042            Mesh::Edge*  _split_edge         (Edge*, Vert*);
00043            Mesh::Plane* _split_plane        (Plane*, Vert*, Vert*);
00044            bool         _get_facet_topology (Mesh::Vert **,
00045                                              Mesh::Edge **,
00046                                              unsigned,
00047                                              const unsigned*,
00048                                              const Vector3*);
00049     
00050 public:
00051     PolygonalMesh (const Vector3 [],        /* array of vertices */
00052                    unsigned,                /* number of vertices or indices */
00053                    const unsigned vIndices[] = NULL /* indices to this array */);
00054 
00055     bool addFacet (const unsigned [], /* vertices */
00056                    const Vector3 [],  /* vertex normals (can be NULL) */
00057                    unsigned,          /* number of vertices */
00058                    const Vector3&     /* facet normal */);
00059 
00060     bool addFacet (const unsigned [], /* vertices */
00061                    const Vector3 [],  /* vertex normals (can be NULL) */
00062                    unsigned           /* number of vertices */);
00063 };
00064 
00065 
00066 
00067 }; // namespace
00068 
00069 #endif // __POLYGONAL_MESH_H

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