~ubuntu-branches/ubuntu/maverick/freecad/maverick

« back to all changes in this revision

Viewing changes to src/Mod/Mesh/App/WildMagic4/Wm4VEManifoldMesh.h

  • Committer: Bazaar Package Importer
  • Author(s): Teemu Ikonen
  • Date: 2009-07-16 18:37:41 UTC
  • Revision ID: james.westby@ubuntu.com-20090716183741-oww9kcxqrk991i1n
Tags: upstream-0.8.2237
ImportĀ upstreamĀ versionĀ 0.8.2237

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Wild Magic Source Code
 
2
// David Eberly
 
3
// http://www.geometrictools.com
 
4
// Copyright (c) 1998-2007
 
5
//
 
6
// This library is free software; you can redistribute it and/or modify it
 
7
// under the terms of the GNU Lesser General Public License as published by
 
8
// the Free Software Foundation; either version 2.1 of the License, or (at
 
9
// your option) any later version.  The license is available for reading at
 
10
// either of the locations:
 
11
//     http://www.gnu.org/copyleft/lgpl.html
 
12
//     http://www.geometrictools.com/License/WildMagicLicense.pdf
 
13
// The license applies to versions 0 through 4 of Wild Magic.
 
14
//
 
15
// Version: 4.0.0 (2006/06/28)
 
16
 
 
17
#ifndef WM4VEMANIFOLDMESH_H
 
18
#define WM4VEMANIFOLDMESH_H
 
19
 
 
20
#include "Wm4FoundationLIB.h"
 
21
#include "Wm4System.h"
 
22
 
 
23
namespace Wm4
 
24
{
 
25
 
 
26
class WM4_FOUNDATION_ITEM VEManifoldMesh
 
27
{
 
28
public:
 
29
    // vertex data types
 
30
    class Vertex;
 
31
    typedef Vertex* VPtr;
 
32
    typedef const Vertex* VCPtr;
 
33
    typedef VPtr (*VCreator)(int);
 
34
    typedef std::map<int,Vertex*> VMap;
 
35
    typedef VMap::iterator VMapIterator;
 
36
    typedef VMap::const_iterator VMapCIterator;
 
37
 
 
38
    // edge data types
 
39
    class Edge;
 
40
    typedef Edge* EPtr;
 
41
    typedef const Edge* ECPtr;
 
42
    typedef EPtr (*ECreator)(int,int);
 
43
    typedef std::map<std::pair<int,int>,Edge*> EMap;
 
44
    typedef EMap::iterator EMapIterator;
 
45
    typedef EMap::const_iterator EMapCIterator;
 
46
 
 
47
    // vertex object
 
48
    class WM4_FOUNDATION_ITEM Vertex
 
49
    {
 
50
    public:
 
51
        Vertex (int iV);
 
52
        virtual ~Vertex ();
 
53
 
 
54
        int V;
 
55
        EPtr E[2];
 
56
    };
 
57
 
 
58
    // edge object
 
59
    class WM4_FOUNDATION_ITEM Edge
 
60
    {
 
61
    public:
 
62
        Edge (int iV0, int iV1);
 
63
        virtual ~Edge ();
 
64
 
 
65
        // vertices, listed as a directed edge <V[0],V[1]>
 
66
        int V[2];
 
67
 
 
68
        // adjacent edges
 
69
        //   E[0] points to edge sharing V[0]
 
70
        //   E[1] points to edge sharing V[1]
 
71
        EPtr E[2];
 
72
    };
 
73
 
 
74
 
 
75
    // construction and destruction
 
76
    VEManifoldMesh (VCreator oVCreator = 0, ECreator oECreator = 0);
 
77
    virtual ~VEManifoldMesh ();
 
78
 
 
79
    // member access
 
80
    const VMap& GetVertices () const;
 
81
    const EMap& GetEdges () const;
 
82
 
 
83
    // mesh manipulation
 
84
    EPtr InsertEdge (int iV0, int iV1);
 
85
    bool RemoveEdge (int iV0, int iV1);
 
86
 
 
87
    // manifold mesh is closed if each vertex is shared twice
 
88
    bool IsClosed () const;
 
89
 
 
90
    void Print (const char* acFilename);
 
91
 
 
92
protected:
 
93
    // vertices
 
94
    static VPtr CreateVertex (int iV0);
 
95
    VCreator m_oVCreator;
 
96
    VMap m_kVMap;
 
97
 
 
98
    // edges
 
99
    static EPtr CreateEdge (int iV0, int iV1);
 
100
    ECreator m_oECreator;
 
101
    EMap m_kEMap;
 
102
};
 
103
 
 
104
#include "Wm4VEManifoldMesh.inl"
 
105
 
 
106
}
 
107
 
 
108
#endif