source: GTP/trunk/Lib/Geom/shared/GTGeometry/include/GeoMeshSimplifier.h @ 891

Revision 891, 4.8 KB checked in by gumbau, 18 years ago (diff)
Line 
1#ifndef __GEO_MESH_SIMPLIFIER__
2#define __GEO_MESH_SIMPLIFIER__
3
4#include "GeoMesh.h"
5#include "GeoMeshSimpSequence.h"
6//#include "SimplificationMethod.h"
7
8namespace Geometry
9{
10        /// Mesh simplificator interface.
11        /** This module is used by both models, general mesh models and the plant and tree models for the trunk and the branches. It contains functions that generate simplified versions of 3D objects made out of triangles. Given a 3D object, this module computes a sequence of geometric transformations that reduce the object’s geometric detail while preserving its appearance. For each simplification step, returns a simplification sequence containing the edge to be collapse, the two triangles being removed and the new triangles remapped to the model.\n\n
12
13Inputs:\n
14        - A pointer to the Geometry::Mesh object containing the 3D model to be simplified.
15        .
16       
17Outputs:\n
18        -# The simplified mesh, contained in a Geometry::Mesh object.
19        -# Simplification sequence, represented by a Geometry::MeshSimplificationSequence object.
20       
21        */
22
23        class MeshSimplifier
24        {
25                public:
26                        /// Class constructor. Retrieves a pointer to a valid Geometry::Mesh object to simplify.
27                        MeshSimplifier( const Geometry::Mesh    *,
28                                                                                        Geometry::TIPOFUNC              upb=0);
29
30                        /// Virtual class destructor.
31                        virtual ~MeshSimplifier (void);
32
33                        /// Copy constructor
34                        //MeshSimplifier(const MeshSimplifier&);
35
36                        /// Assignment operator
37                        //MeshSimplifier& operator =(const MeshSimplifier&);
38
39                        /// Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. This is a pure virtual method and must be overloaded in a derived class that implements a simplification algorithm.
40                        virtual void Simplify (Geometry::Real)=0;
41
42                        /// Starts the simplification process. Receives as a parameter the number of vertices of the resulting mesh. This is a pure virtual method and must be overloaded in a derived class that implements a simplification algorithm.
43                        virtual void Simplify (Geometry::uint32)=0;
44
45                        /// Returns the simplified mesh.
46                        Mesh *GetMesh ();
47
48                        /// Returns the simplification sequence for general meshes.
49                        MeshSimplificationSequence *GetSimplificationSequence();
50
51                        // Sets what is the mesh that stores the leaves
52                        void setMeshLeaves(Geometry::Index);
53
54                protected:
55
56                        //private: // fer protected
57                        Mesh *meshsalida;
58                        MeshSimplificationSequence *msimpsequence;
59                        const Mesh *objmesh;
60
61                        Geometry::Index indexMeshLeaves;
62
63                        //      Progress bar function.
64                        Geometry::TIPOFUNC      mUPB;
65        };
66
67        /// Implementation of a simplification algorithm based on viewpoint.
68        /** This class implements a simplification algorithm based on a viewpoint evaluation technique. */
69        class ViewPointDrivenSimplifier : public MeshSimplifier
70        {
71        private:
72
73        public:
74                /// Class constructor. Will call Simplifier class constructor.
75                ViewPointDrivenSimplifier (const Geometry::Mesh         *,
76                                                                                                        Geometry::TIPOFUNC              upb=0);
77
78                /// Class destructor.
79                virtual ~ViewPointDrivenSimplifier (void);
80
81                /// Copy constructor
82                //ViewPointDrivenSimplifier(const ViewPointDrivenSimplifier&);
83
84                /// Assignment operator
85                //ViewPointDrivenSimplifier& operator =(const ViewPointDrivenSimplifier&);
86
87                /// Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. Implements the Simplifier::Simplify method to perform an image based simplification.
88                void Simplify (Geometry::Real);
89
90                /// Starts the simplification process. Receives as a parameter the number of vertices of the resulting mesh. Implements the Simplifier::Simplify method to perform an image based simplification.
91                void Simplify (Geometry::uint32);
92
93        };
94
95
96        /// Implementation of a simplification algorithm based on geometry information.
97        /** This class implements a simplification algorithm based on a classic geometry evaluation technique. */
98        class GeometryBasedSimplifier : public MeshSimplifier
99        {
100        public:
101                /// Class constructor. Will call Simplifier class constructor.
102                GeometryBasedSimplifier (       const Geometry::Mesh    *,
103                                                                                                                        Geometry::TIPOFUNC              upb=0);
104
105                /// Class destructor.
106                virtual ~GeometryBasedSimplifier (void);
107
108                /// Copy constructor
109                //GeometryBasedSimplifier(const GeometryBasedSimplifier&);
110
111                /// Assignment operator
112                //GeometryBasedSimplifier& operator =(const GeometryBasedSimplifier&);
113
114                /// Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. Implements the Simplifier::Simplify method to perform an image based simplification.
115                void Simplify (Geometry::Real);
116
117                /// Starts the simplification process. Receives as a parameter the number of vertices of the resulting mesh. Implements the Simplifier::Simplify method to perform an image based simplification.
118                void Simplify (Geometry::uint32);
119        };
120} // end of Geometry namespace;
121
122#endif
Note: See TracBrowser for help on using the repository browser.