#ifndef __GEO_TREE_SIMPLIFIER__ #define __GEO_TREE_SIMPLIFIER__ #include "GeoMesh.h" #include "GeoTreeSimpSequence.h" #include "Hoja.h" #define K1 0.8f //distancia #define K2 0.2f // coplanar namespace Geometry { /// Tree Simplifier interface /*** This module is used by LODTree to simplify leaves of a tree. It contains functions that generate simplified versions of 3D objects made out of quads (represented as pairs of texture-mapped triangles). Given a 3D object, this module computes a sequence of geometric transformations that reduce the object’s geometric detail while preserving its appearance.\n\n For each simplification step, the module returns a simplification sequence containing the leaf collapsed, the two leaves being removed, and the resulting leaf for that contraction.\n\n Inputs:\n - A pointer to the Geometry::Mesh object containing the tree to be simplified. . Outputs:\n -# The simplified mesh, contained in a Geometry::Mesh object. -# Simplification sequence, represented by a Geometry::TreeSimplificationSequence object. */ class TreeSimplifier { public: /// Class constructor. Retrieves a pointer to a valid Mesh object to simplify TreeSimplifier( const Geometry::Mesh *, Geometry::TIPOFUNC upb=0); /// Class destructor. ~TreeSimplifier(void); /// Copy constructor //TreeSimplifier(const TreeSimplifier&); /// Assignment operator //TreeSimplifier& operator =(const TreeSimplifier&); /// Starts the simplification process. Receives as a parameter the LOD factor in a range of [0,1]. void Simplify(Geometry::Real,Geometry::Index); /// Returns the simplified mesh. Mesh *GetMesh(); /// Returns the simplification sequence for leaves. TreeSimplificationSequence *GetSimplificationSequence(); //private: void Centroh(Hoja &); void GetNormal(Hoja &); void DistanciaEntreHojas(void); void CoplanarEntreHojas(FILE*); float DiametroEsferaEnvolvente(); void EstableceCriterio(float); float max(float, float); float min(float, float); //long int Colapsa (TreeSimplificationSequence *, float); long int Colapsa(float); void DosMayores(float*, int* ); void ElijeVertices(Hoja& , Hoja& , long int); float Hausdorff(Hoja &, Hoja&); float distan(float, float, float, float, float, float); long int MinimaDistancia(void); void NormalizaDistancia(float diametro); void EstableceCriterio2(float, long int); long int MinimoCriterio(void); void Mesh2Estructura( const Geometry::Mesh *, Index); void EscribeMesh(int); Mesh *mesh; // objeto mesh simplificado (para la salida) const Mesh *objmesh; float (*Vertex)[3]; Hoja *Hojasa; // las activas long int activas, counth; TreeSimplificationSequence *mtreesimpsequence; private: // Update progress bar. Geometry::TIPOFUNC mUPB; }; } #endif