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

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

GTGeometry and GeoTool? initial imports

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 images.
68        /** This class implements a simplification algorithm based on an image evaluation technique. */
69        class ImageBasedSimplifier : public MeshSimplifier
70        {
71        public:
72                /// Class constructor. Will call Simplifier class constructor.
73                ImageBasedSimplifier (const Geometry::Mesh      *,
74                                                                                                        Geometry::TIPOFUNC              upb=0);
75
76                /// Class destructor.
77                virtual ~ImageBasedSimplifier (void);
78
79                /// Copy constructor
80                //ImageBasedSimplifier(const ImageBasedSimplifier&);
81
82                /// Assignment operator
83                //ImageBasedSimplifier& operator =(const ImageBasedSimplifier&);
84
85                /// 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.
86                void Simplify (Geometry::Real);
87
88                /// 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.
89                void Simplify (Geometry::uint32);
90
91        };
92
93
94        /// Implementation of a simplification algorithm based on geometry information.
95        /** This class implements a simplification algorithm based on a classic geometry evaluation technique. */
96        class GeometryBasedSimplifier : public MeshSimplifier
97        {
98        public:
99                /// Class constructor. Will call Simplifier class constructor.
100                GeometryBasedSimplifier (       const Geometry::Mesh    *,
101                                                                                                                        Geometry::TIPOFUNC              upb=0);
102
103                /// Class destructor.
104                virtual ~GeometryBasedSimplifier (void);
105
106                /// Copy constructor
107                //GeometryBasedSimplifier(const GeometryBasedSimplifier&);
108
109                /// Assignment operator
110                //GeometryBasedSimplifier& operator =(const GeometryBasedSimplifier&);
111
112                /// 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.
113                void Simplify (Geometry::Real);
114
115                /// 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.
116                void Simplify (Geometry::uint32);
117        };
118} // end of Geometry namespace;
119
120#endif
Note: See TracBrowser for help on using the repository browser.