changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Nurbs / Internal / OSGDCTPVertex.h
blob35deea283046d2afb6de0f713eca1238434e2fe3
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_DCTPVERTEX_H_
39 #define _OSG_DCTPVERTEX_H_
40 #ifdef __sgi
41 #pragma once
42 #endif
44 #include "OSGDrawableDef.h"
45 #include "OSGConfig.h"
47 #include <iostream>
48 #include <fstream>
49 #include <iomanip>
51 #include "OSGdctptypes.h"
53 OSG_BEGIN_NAMESPACE
56 class DCTPFace;
57 class DCTPEdge;
59 class OSG_DRAWABLE_DLLMAPPING DCTPVertex
61 public:
62 DCTPVertex() : edges(), faces(), coords(), id(), node_id(), vertexinfo(NULL)
66 ~DCTPVertex() {}
69 std::vector<DCTPEdge*> edges;
70 std::vector<DCTPFace*> faces;
71 #ifdef OSG_INTEGER_MESH
72 vec3i coords;
73 #else
74 Vec3d coords;
75 #endif
76 unsigned long id; // unique id of this vertex
77 unsigned long node_id; // uniqe ID of the surface graph node
78 void *vertexinfo;
80 void RemoveFace(DCTPFace *f)
82 std::vector<DCTPFace*>::iterator fe = faces.end();
83 bool erased = false;
85 for(std::vector<DCTPFace*>::iterator i = faces.begin(); i != fe; ++i)
86 if( (*i) == f)
88 // faces.erase( i );
89 *i = faces[faces.size() - 1];
90 faces.pop_back();
91 erased = true;
92 break;
95 if(!erased)
97 std::cerr << "DCTPVertex::RemoveFace: trying to remove nonexistant face..." << std::endl;
100 void AddFace(DCTPFace *f)
102 std::vector<DCTPFace*>::iterator fe = faces.end();
103 bool found = false;
105 for(std::vector<DCTPFace*>::iterator i = faces.begin(); i != fe; ++i)
106 if( (*i) == f)
108 found = true; break;
111 if(!found)
112 faces.push_back(f);
114 void RemoveEdge(DCTPEdge *e)
116 std::vector<DCTPEdge*>::iterator ee = edges.end();
117 bool erased = false;
119 for(std::vector<DCTPEdge*>::iterator i = edges.begin(); i != ee; ++i)
120 if( (*i) == e)
122 // edges.erase( i );
123 *i = edges[edges.size() - 1];
124 edges.pop_back();
125 erased = true;
126 break;
129 if(!erased)
130 std::cerr << "DCTPVertex::RemoveEdge: trying to remove nonexistant edge..." << std::endl;
133 struct DCTPVertexless
135 bool operator()(DCTPVertex* v1, DCTPVertex* v2) const
137 // std::cerr << "comparing: " << v1->coords << " and" << std::endl;
138 // std::cerr << " " << v2->coords << std::endl;
139 // std::cerr << "pointers: " << v1 << " and" << std::endl;
140 // std::cerr << " " << v2 << std::endl;
141 // bool k = v1->coords < v2->coords;
142 // std::cerr << "result: " << k << std::endl;
143 // return k;
144 // return (v1->coords < v2->coords);
145 return DCTPVecIsLesser(v1->coords, v2->coords);
149 private:
151 DCTPVertex(const DCTPVertex &other);
152 void operator =(const DCTPVertex &rhs);
155 typedef std::set<DCTPVertex*, DCTPVertex::DCTPVertexless> dctpvertexset;
157 typedef std::vector<DCTPVertex*> dctpvertexvector;
158 typedef std::vector<dctpvertexvector> dctpvertexmatrix;
160 OSG_END_NAMESPACE
162 #endif // DCTPVertex.h