fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Drawables / Nurbs / Internal / OSGDCTPEdge.h
blobe06f0f90c2108702ffb6186f3bb6bdceb0ae2cd0
1 /*---------------------------------------------------------------------------*\
2 * OpenSG NURBS Library *
3 * *
4 * *
5 * Copyright (C) 2001-2006 by the University of Bonn, Computer Graphics Group*
6 * *
7 * http://cg.cs.uni-bonn.de/ *
8 * *
9 * contact: edhellon@cs.uni-bonn.de, guthe@cs.uni-bonn.de, rk@cs.uni-bonn.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
38 #ifndef _OSG_DCTPEDGE_H_
39 #define _OSG_DCTPEDGE_H_
40 #ifdef __sgi
41 #pragma once
42 #endif
44 #include "OSGDrawableDef.h"
45 #include "OSGConfig.h"
48 #include <iostream>
49 #include <fstream>
50 #include <iomanip>
54 #include "OSGdctptypes.h"
56 OSG_BEGIN_NAMESPACE
59 * This define decides whether to use a std::set for storing the edges of the
60 * mesh, or just use a std::vector. We originally thought using a set speeds
61 * up some operations, but in practice for large models the vector data
62 * structure actually works better (faster).
64 * Please note that if you decide to use a set, the "sorting" of the edges is
65 * based on the lexicographic sort of the physical addresses of their vertices,
66 * which means that you might get some edges "reversed" in the mesh from
67 * the same input data. Due to the nature of the graph-traversing algorithm,
68 * (it starts by searching a direted edge) you might get slightly different
69 * different triangulations for the same surface in different runs.
71 * (Our) default is not to use a set (i.e. to use a vector).
73 #define OSG_NO_EDGE_SET
76 class DCTPVertex;
77 OSG_END_NAMESPACE
78 //class DCTPFace;
79 #include "OSGDCTPFace.h"
81 OSG_BEGIN_NAMESPACE
83 class OSG_DRAWABLE_DLLMAPPING DCTPEdge
85 public:
86 inline DCTPEdge(DCTPVertex * vx1, DCTPVertex * vx2, int orient);
87 inline ~DCTPEdge(void );
89 inline void getVertices(DCTPVertex *&vx1, DCTPVertex *&vx2);
90 inline void setVertices(DCTPVertex * vx1, DCTPVertex * vx2);
92 inline void AddFace (DCTPFace *f);
93 inline void RemoveFace(DCTPFace *f);
95 private:
96 DCTPVertex *v1;
97 DCTPVertex *v2;
99 public:
100 dctpfacevector faces;
102 public:
103 int orientation; // >0: first vertex->second vertex
104 // 0: not oriented
105 // <0: second vertec->first vertex
106 unsigned long id; // unique id of this edge
107 void *edgeinfo;
109 #ifndef OSG_NO_EDGE_SET
110 struct DCTPEdgeless
112 inline bool operator()(DCTPEdge *e1, DCTPEdge *e2) const;
114 #endif
117 private:
119 DCTPEdge(const DCTPEdge &other);
120 void operator =(const DCTPEdge &rhs);
123 #ifdef OSG_NO_EDGE_SET
124 typedef std::vector<DCTPEdge* > dctpedgevector;
125 #else
126 typedef std::set <DCTPEdge*, DCTPEdge::DCTPEdgeless> dctpedgeset;
127 #endif
129 OSG_END_NAMESPACE
131 #include "OSGDCTPEdge.inl"
133 #endif // DCTPEdge.h