GteVETManifoldMesh.h
Go to the documentation of this file.
1 // David Eberly, Geometric Tools, Redmond WA 98052
2 // Copyright (c) 1998-2017
3 // Distributed under the Boost Software License, Version 1.0.
4 // http://www.boost.org/LICENSE_1_0.txt
5 // http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6 // File Version: 3.0.0 (2016/06/19)
7 
8 #pragma once
9 
11 #include <set>
12 
13 // The VETManifoldMesh class represents an edge-triangle manifold mesh
14 // but additionally stores vertex adjacency information.
15 
16 namespace gte
17 {
18 
20 {
21 public:
22  // Vertex data types.
23  class Vertex;
24  typedef std::shared_ptr<Vertex> (*VCreator)(int);
25  typedef std::map<int, std::shared_ptr<Vertex>> VMap;
26 
27  // Vertex object.
29  {
30  public:
31  virtual ~Vertex();
32  Vertex(int vIndex);
33 
34  // The index into the vertex pool of the mesh.
35  int V;
36 
37  // Adjacent objects.
38  std::set<int> VAdjacent;
39  std::set<std::shared_ptr<Edge>> EAdjacent;
40  std::set<std::shared_ptr<Triangle>> TAdjacent;
41  };
42 
43 
44  // Construction and destruction.
45  virtual ~VETManifoldMesh();
46  VETManifoldMesh(VCreator vCreator = nullptr, ECreator eCreator = nullptr, TCreator tCreator = nullptr);
47 
48  // Support for a deep copy of the mesh. The mVMap, mEMap, and mTMap
49  // objects have dynamically allocated memory for vertices, edges, and
50  // triangles. A shallow copy of the pointers to this memory is
51  // problematic. Allowing sharing, say, via std::shared_ptr, is an
52  // option but not really the intent of copying the mesh graph.
53  VETManifoldMesh(VETManifoldMesh const& mesh);
54  VETManifoldMesh& operator=(VETManifoldMesh const& mesh);
55 
56  // Member access.
57  VMap const& GetVertices() const;
58 
59  // If <v0,v1,v2> is not in the mesh, a Triangle object is created and
60  // returned; otherwise, <v0,v1,v2> is in the mesh and nullptr is returned.
61  // If the insertion leads to a nonmanifold mesh, the call fails with a
62  // nullptr returned.
63  virtual std::shared_ptr<Triangle> Insert(int v0, int v1, int v2) override;
64 
65  // If <v0,v1,v2> is in the mesh, it is removed and 'true' is returned;
66  // otherwise, <v0,v1,v2> is not in the mesh and 'false' is returned.
67  virtual bool Remove(int v0, int v1, int v2) override;
68 
69  // Destroy the vertices, edges, and triangles to obtain an empty mesh.
70  virtual void Clear() override;
71 
72 protected:
73  // The vertex data and default vertex creation.
74  static std::shared_ptr<Vertex> CreateVertex(int vIndex);
75  VCreator mVCreator;
76  VMap mVMap;
77 };
78 
79 }
GLfloat GLfloat v1
Definition: glcorearb.h:812
std::set< std::shared_ptr< Edge > > EAdjacent
std::set< std::shared_ptr< Triangle > > TAdjacent
typedef int(WINAPI *PFNWGLRELEASEPBUFFERDCARBPROC)(HPBUFFERARB hPbuffer
GLfloat v0
Definition: glcorearb.h:811
GLfloat GLfloat GLfloat v2
Definition: glcorearb.h:813
std::map< int, std::shared_ptr< Vertex > > VMap
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:02