fixed: auto_ptr -> unique_ptr
[opensg.git] / Source / System / NodeCores / Drawables / Nurbs / Internal / OSGGraphTraverser.h
blobb059a035b49b3f5571cad7eaf05e7c7dce22879a
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_GRAPHTRAVERSER_H_
39 #define _OSG_GRAPHTRAVERSER_H_
40 #ifdef __sgi
41 #pragma once
42 #endif
44 #include "OSGDrawableDef.h"
45 #include "OSGConfig.h"
47 #include <stdlib.h>
48 #include <math.h>
49 #include <stdio.h>
50 #include "OSGDirectedGraph.h"
51 #include "OSGSimplePolygon.h"
53 OSG_BEGIN_NAMESPACE
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
63 public:
64 int errtype;
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;
80 bool usedelaunay;
82 public:
83 GraphTraverser() :
84 g (NULL ),
85 polys ( ),
86 globalverts( ),
87 usedelaunay(false)
91 ~GraphTraverser() {}
92 void Initialize(DirectedGraph<Vec2d, unsigned char>& gg, bool
93 usedelaunaytri);
94 int getNextEdge(const int nodeid, const int previd /*const double& in_angle*/);
95 int Traverse(void);
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()
105 return &polys;
107 DCTPVec2dvector* getVertices()
109 return &globalverts;
112 private:
114 GraphTraverser(const GraphTraverser &other);
115 void operator =(const GraphTraverser &rhs);
118 OSG_END_NAMESPACE
120 #endif