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_QUADTREECREATOR_H_
39 #define _OSG_QUADTREECREATOR_H_
44 #include "OSGDrawableDef.h"
45 #include "OSGConfig.h"
51 #include "OSGBezierCurve2D.h"
52 #include "OSGBezierTensorSurface.h"
53 #include "OSGDCTPMesh.h"
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)
69 DCTPMesh
*qtm
; //quadtreemesh
70 // bool m_bForTrimming;
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
);
80 QuadTreeCreator(DCTPMesh
* mesh
/*, bool bForTrimming*/) :
82 /*m_bForTrimming = bForTrimming;*/
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);
106 QuadTreeCreator(const QuadTreeCreator
&other
);
107 void operator=(const QuadTreeCreator
&rhs
);
113 #endif //QuadTreeCreator.h