1 /*---------------------------------------------------------------------------*\
2 * OpenSG NURBS Library *
5 * Copyright (C) 2001-2006 by the University of Bonn, Computer Graphics Group*
7 * http://cg.cs.uni-bonn.de/ *
9 * contact: edhellon@cs.uni-bonn.de, guthe@cs.uni-bonn.de, rk@cs.uni-bonn.de *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
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. *
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. *
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. *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
37 \*---------------------------------------------------------------------------*/
38 #ifndef _OSG_GRAPHTRAVERSER_H_
39 #define _OSG_GRAPHTRAVERSER_H_
44 #include "OSGDrawableDef.h"
45 #include "OSGConfig.h"
50 #include "OSGDirectedGraph.h"
51 #include "OSGSimplePolygon.h"
55 static const int ERR_NO_TRIMMING
= -1;
56 static const int ERR_GETNEXTEDGE
= -2;
57 static const int ERR_ZERO_SIZE
= -3;
58 static const int ERR_ALL_ZERO
= -4;
59 static const int ERR_TRIANGULATE
= -5;
61 class OSG_DRAWABLE_DLLMAPPING GraphTraverserError
66 GraphTraverserError() : errtype(0)
69 ~GraphTraverserError() {}
70 GraphTraverserError(int t
) : errtype(t
)
75 class OSG_DRAWABLE_DLLMAPPING GraphTraverser
77 DirectedGraph
<Vec2d
, unsigned char>* g
;
78 simplepolygonvector polys
;
79 DCTPVec2dvector globalverts
;
92 void Initialize(DirectedGraph
<Vec2d
, unsigned char>& gg
, bool
94 int getNextEdge(const int nodeid
, const int previd
/*const double& in_angle*/);
96 int triangulatePolygon(DCTPivector
& nodes
, bool bConvex
);
97 int getADirectedEdge(void);
98 void handleEdge(int eid
, int to_nid
, int &from_nid
/* double& ang*/);
99 int getOtherEnd(int eid
, int nid
);
100 int getOutGoingEdge(int nid
);
103 simplepolygonvector
* getPolys()
107 DCTPVec2dvector
* getVertices()
114 GraphTraverser(const GraphTraverser
&other
);
115 void operator =(const GraphTraverser
&rhs
);