[138] | 1 | #ifndef __GEO_MESH_SIMPLIFIER__
|
---|
| 2 | #define __GEO_MESH_SIMPLIFIER__
|
---|
| 3 |
|
---|
| 4 | #include "GeoMesh.h"
|
---|
| 5 | #include "GeoMeshSimpSequence.h"
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | namespace 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 objects 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 |
|
---|
| 13 | Inputs:\n
|
---|
| 14 | - A pointer to the Geometry::Mesh object containing the 3D model to be simplified.
|
---|
| 15 | .
|
---|
| 16 |
|
---|
| 17 | Outputs:\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 |
|
---|
| 29 | /// Virtual class destructor.
|
---|
| 30 | virtual ~MeshSimplifier (void);
|
---|
| 31 |
|
---|
| 32 | /// Copy constructor
|
---|
| 33 | //MeshSimplifier(const MeshSimplifier&);
|
---|
| 34 |
|
---|
| 35 | /// Assignment operator
|
---|
| 36 | //MeshSimplifier& operator =(const MeshSimplifier&);
|
---|
| 37 |
|
---|
| 38 | /// 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.
|
---|
| 39 | virtual void Simplify (Geometry::Real)=0;
|
---|
| 40 |
|
---|
| 41 | /// 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.
|
---|
| 42 | virtual void Simplify (Geometry::uint32)=0;
|
---|
| 43 |
|
---|
| 44 | /// Returns the simplified mesh.
|
---|
| 45 | Mesh *GetMesh ();
|
---|
| 46 |
|
---|
| 47 | /// Returns the simplification sequence for general meshes.
|
---|
| 48 | MeshSimplificationSequence *GetSimplificationSequence();
|
---|
| 49 |
|
---|
| 50 | };
|
---|
| 51 |
|
---|
| 52 | /// Implementation of a simplification algorithm based on images.
|
---|
| 53 | /** This class implements a simplification algorithm based on an image evaluation technique. */
|
---|
| 54 | class ImageBasedSimplifier : public MeshSimplifier
|
---|
| 55 | {
|
---|
| 56 | public:
|
---|
| 57 | /// Class constructor. Will call Simplifier class constructor.
|
---|
| 58 | ImageBasedSimplifier (const Geometry::Mesh *);
|
---|
| 59 |
|
---|
| 60 | /// Class destructor.
|
---|
| 61 | virtual ~ImageBasedSimplifier (void);
|
---|
| 62 |
|
---|
| 63 | /// Copy constructor
|
---|
| 64 | //ImageBasedSimplifier(const ImageBasedSimplifier&);
|
---|
| 65 |
|
---|
| 66 | /// Assignment operator
|
---|
| 67 | //ImageBasedSimplifier& operator =(const ImageBasedSimplifier&);
|
---|
| 68 |
|
---|
| 69 | /// 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.
|
---|
| 70 | void Simplify (Geometry::Real);
|
---|
| 71 |
|
---|
| 72 | /// 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.
|
---|
| 73 | void Simplify (Geometry::uint32);
|
---|
| 74 | };
|
---|
| 75 |
|
---|
| 76 |
|
---|
| 77 | /// Implementation of a simplification algorithm based on geometry information.
|
---|
| 78 | /** This class implements a simplification algorithm based on a classic geometry evaluation technique. */
|
---|
| 79 | class GeometryBasedSimplifier : public MeshSimplifier
|
---|
| 80 | {
|
---|
| 81 | public:
|
---|
| 82 | /// Class constructor. Will call Simplifier class constructor.
|
---|
| 83 | GeometryBasedSimplifier (const Geometry::Mesh *);
|
---|
| 84 |
|
---|
| 85 | /// Class destructor.
|
---|
| 86 | virtual ~GeometryBasedSimplifier (void);
|
---|
| 87 |
|
---|
| 88 | /// Copy constructor
|
---|
| 89 | //GeometryBasedSimplifier(const GeometryBasedSimplifier&);
|
---|
| 90 |
|
---|
| 91 | /// Assignment operator
|
---|
| 92 | //GeometryBasedSimplifier& operator =(const GeometryBasedSimplifier&);
|
---|
| 93 |
|
---|
| 94 | /// 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.
|
---|
| 95 | void Simplify (Geometry::Real);
|
---|
| 96 |
|
---|
| 97 | /// 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.
|
---|
| 98 | void Simplify (Geometry::uint32);
|
---|
| 99 | };
|
---|
| 100 |
|
---|
| 101 | }
|
---|
| 102 |
|
---|
| 103 | #endif |
---|