#ifndef __GEO_MESH_SIMPLIFIER__ #define __GEO_MESH_SIMPLIFIER__ #include "GeoMesh.h" #include "GeoMeshSimpSequence.h" namespace Geometry { /// Mesh simplificator interface. /** 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 Inputs:\n - A pointer to the Geometry::Mesh object containing the 3D model to be simplified. . Outputs:\n -# The simplified mesh, contained in a Geometry::Mesh object. -# Simplification sequence, represented by a Geometry::MeshSimplificationSequence object. */ class MeshSimplifier { public: /// Class constructor. Retrieves a pointer to a valid Geometry::Mesh object to simplify. MeshSimplifier (const Geometry::Mesh *); /// Virtual class destructor. virtual ~MeshSimplifier (void); /// Copy constructor //MeshSimplifier(const MeshSimplifier&); /// Assignment operator //MeshSimplifier& operator =(const MeshSimplifier&); /// 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. virtual void Simplify (Geometry::Real)=0; /// 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. virtual void Simplify (Geometry::uint32)=0; /// Returns the simplified mesh. Mesh *GetMesh (); /// Returns the simplification sequence for general meshes. MeshSimplificationSequence *GetSimplificationSequence(); }; /// Implementation of a simplification algorithm based on images. /** This class implements a simplification algorithm based on an image evaluation technique. */ class ImageBasedSimplifier : public MeshSimplifier { public: /// Class constructor. Will call Simplifier class constructor. ImageBasedSimplifier (const Geometry::Mesh *); /// Class destructor. virtual ~ImageBasedSimplifier (void); /// Copy constructor //ImageBasedSimplifier(const ImageBasedSimplifier&); /// Assignment operator //ImageBasedSimplifier& operator =(const ImageBasedSimplifier&); /// 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. void Simplify (Geometry::Real); /// 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. void Simplify (Geometry::uint32); }; /// Implementation of a simplification algorithm based on geometry information. /** This class implements a simplification algorithm based on a classic geometry evaluation technique. */ class GeometryBasedSimplifier : public MeshSimplifier { public: /// Class constructor. Will call Simplifier class constructor. GeometryBasedSimplifier (const Geometry::Mesh *); /// Class destructor. virtual ~GeometryBasedSimplifier (void); /// Copy constructor //GeometryBasedSimplifier(const GeometryBasedSimplifier&); /// Assignment operator //GeometryBasedSimplifier& operator =(const GeometryBasedSimplifier&); /// 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. void Simplify (Geometry::Real); /// 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. void Simplify (Geometry::uint32); }; } #endif