source: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoTreeSimplifier.h @ 774

Revision 774, 2.9 KB checked in by gumbau, 18 years ago (diff)

GTGeometry and GeoTool? initial imports

Line 
1#ifndef __GEO_TREE_SIMPLIFIER__
2#define __GEO_TREE_SIMPLIFIER__
3
4#include "GeoMesh.h"
5#include "GeoTreeSimpSequence.h"
6#include "Hoja.h"
7
8#define K1              0.8f //distancia
9#define K2              0.2f // coplanar
10
11namespace Geometry
12{
13        /// Tree Simplifier interface
14        /*** This module is used by LODTree to simplify leaves of a tree. It contains functions that generate simplified
15        versions of 3D objects made out of quads (represented as pairs of texture-mapped triangles). Given a 3D object, this
16        module computes a sequence of geometric transformations that reduce the object’s geometric detail while preserving
17        its appearance.\n\n
18
19        For each simplification step, the module returns a simplification sequence containing the leaf collapsed, the two
20        leaves being removed, and the resulting leaf for that contraction.\n\n
21
22       
23Inputs:\n
24        - A pointer to the Geometry::Mesh object containing the tree to be simplified.
25        .
26
27Outputs:\n
28        -# The simplified mesh, contained in a Geometry::Mesh object.
29        -# Simplification sequence, represented by a Geometry::TreeSimplificationSequence object.
30        */
31
32        class TreeSimplifier
33        {
34        public:
35                /// Class constructor. Retrieves a pointer to a valid Mesh object to simplify
36                TreeSimplifier( const Geometry::Mesh    *,
37                                                                                Geometry::TIPOFUNC              upb=0);
38
39                /// Class destructor.
40                ~TreeSimplifier(void);
41
42                /// Copy constructor
43                //TreeSimplifier(const TreeSimplifier&);
44
45                /// Assignment operator
46                //TreeSimplifier& operator =(const TreeSimplifier&);
47
48                /// Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1].
49                void Simplify(Geometry::Real,Geometry::Index);
50       
51                /// Returns the simplified mesh.
52                Mesh *GetMesh();
53
54                /// Returns the simplification sequence for leaves.
55                TreeSimplificationSequence *GetSimplificationSequence();
56
57        //private:
58                void Centroh(Hoja       &);
59                void GetNormal(Hoja     &);
60                void DistanciaEntreHojas(void);
61                void CoplanarEntreHojas(FILE*);
62                float DiametroEsferaEnvolvente();
63                void EstableceCriterio(float);
64
65                float max(float, float);
66                float min(float, float);
67
68                //long int Colapsa (TreeSimplificationSequence *, float);
69                long int Colapsa(float);
70                void DosMayores(float*, int* );
71                void ElijeVertices(Hoja& , Hoja& , long int);
72                float Hausdorff(Hoja &, Hoja&);
73                float distan(float, float, float, float, float, float);
74                long int MinimaDistancia(void);
75                void NormalizaDistancia(float diametro);
76                void EstableceCriterio2(float, long int);
77                long int MinimoCriterio(void);
78
79                void Mesh2Estructura(   const Geometry::Mesh *,
80                                                                                                        Index);
81               
82                void EscribeMesh(int);
83
84                Mesh                    *mesh; // objeto mesh simplificado (para la salida)
85                const                   Mesh *objmesh;
86                float                   (*Vertex)[3];
87                Hoja                    *Hojasa;  // las activas
88                long int        activas, counth;
89                TreeSimplificationSequence      *mtreesimpsequence;
90               
91        private:
92                //      Update progress bar.
93                Geometry::TIPOFUNC      mUPB;
94        };
95}
96
97#endif
Note: See TracBrowser for help on using the repository browser.