changed: gcc8 base update
[opensg.git] / Source / System / NodeCores / Drawables / Nurbs / Internal / OSGQuadTreeCreator.h
blobb8c647ee470eeb9f8c38c78b8223d6f42d04aa0c
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_QUADTREECREATOR_H_
39 #define _OSG_QUADTREECREATOR_H_
40 #ifdef __sgi
41 #pragma once
42 #endif
44 #include "OSGDrawableDef.h"
45 #include "OSGConfig.h"
48 #include <math.h>
49 #include <vector>
50 #include <stdlib.h>
51 #include "OSGBezierCurve2D.h"
52 #include "OSGBezierTensorSurface.h"
53 #include "OSGDCTPMesh.h"
55 OSG_BEGIN_NAMESPACE
57 class ParSpaceTrimmer;
59 class OSG_DRAWABLE_DLLMAPPING QuadTreeCreator
62 friend class ParSpaceTrimmer;
64 //this class contains the algorithm to create a quadtree for the triangulation
65 //of a BezierTensorSurface matrix
66 //there is a constraint on the letters of the quadtree: their depth level should
67 //not differ more than 1 (it's a constraint to be able to triangulate easily)
68 protected:
69 DCTPMesh *qtm; //quadtreemesh
70 // bool m_bForTrimming;
72 double error_epsilon;
73 double computeApproximationError(DCTPFace *f);
74 //returns error of triangualtion when creating an approximation of
75 //a B.TensorSurf. with two triangles
76 double computeBilinearNorm(DCTPFace *face);
77 int finishSubdivisions(DCTPFace *f);
79 public:
80 QuadTreeCreator(DCTPMesh * mesh /*, bool bForTrimming*/) :
81 qtm (mesh),
82 /*m_bForTrimming = bForTrimming;*/
83 error_epsilon(0.0 )
87 ~QuadTreeCreator()
89 dctpfacevector::iterator fe = qtm->faces.end();
91 for(dctpfacevector::iterator f = qtm->faces.begin(); f != fe; ++f)
92 delete static_cast<BezierTensorSurface*>((*f)->faceinfo);
94 void setErrorTolerance(double epsilon)
96 error_epsilon = epsilon;
98 int setInitialLeaves(const beziersurfacematrix& patches,
99 const DCTPdvector& intervals_u,
100 const DCTPdvector& intervals_v); //sets starting leaves
101 int createQuadTree(void); //well... go figure
102 void resetMesh(void);
104 private:
106 QuadTreeCreator(const QuadTreeCreator &other);
107 void operator=(const QuadTreeCreator &rhs);
111 OSG_END_NAMESPACE
113 #endif //QuadTreeCreator.h