source: GTP/trunk/Lib/Geom/shared/GTGeometry/src/libs/SimplificationMethod.h @ 1025

Revision 1025, 2.9 KB checked in by gumbau, 18 years ago (diff)

namespace simplif

RevLine 
[774]1#pragma once
2
3#include <set>
4#include <map>
5#include <vector>
6#include <list>
7#include <iostream>
[1025]8#include <simplif.h>
[774]9#include <GeoMeshSimplifier.h>
10
11class SimplificationMethod
12{
13private:
[980]14        Geometry::Mesh  *mGeoMesh;
[1025]15        void compute_pair_info(simplif::pair_info*);
16        simplif::Model M0;
17        simplif::array<simplif::vert_info> vinfo;
18        simplif::Heap *heap;
19        simplif::real proximity_limit;    // distance threshold squared
[774]20        int initialVertCount;
21        int initialEdgeCount;
22        int initialFaceCount;
23
[1025]24        inline simplif::vert_info& vertex_info(simplif::Vertex *v)
[1007]25        {
26                return vinfo(v->validID());
27        }
28       
[1025]29        simplif::real pair_mesh_penalty(simplif::Model& M,
30                                                                                                                                simplif::Vertex *v1,
31                                                                                                                                simplif::Vertex *v2,
32                                                                                                                                simplif::Vec3& vnew);
[1007]33       
[1025]34        int predict_face(simplif::Face& F,
35                                                                        simplif::Vertex *v1,
36                                                                        simplif::Vertex *v2,
37                                                                        simplif::Vec3& vnew,
38                                                                        simplif::Vec3& f1,
39                                                                        simplif::Vec3& f2,
40                                                                        simplif::Vec3& f3);
[1007]41       
[1025]42        bool check_for_pair(simplif::Vertex *v0, simplif::Vertex *v1);
[1007]43       
[1025]44        simplif::pair_info *new_pair(simplif::Vertex *v0, simplif::Vertex *v1);
[1007]45       
[1025]46        void delete_pair(simplif::pair_info *pair);
[1007]47       
[1025]48        void do_contract(simplif::Model& m, simplif::pair_info *pair);
[1007]49       
[1025]50        bool decimate_quadric(simplif::Vertex *v, simplif::Mat4& Q);
[1007]51       
[1025]52        void decimate_contract(simplif::Model& m);
[1007]53       
[1025]54        simplif::real decimate_error(simplif::Vertex *v);
[1007]55       
[1025]56        simplif::real decimate_min_error();
[1007]57       
[1025]58        simplif::real decimate_max_error(simplif::Model& m);
[1007]59       
[1025]60        void decimate_init(simplif::Model& m, simplif::real limit);
[1007]61       
[1025]62        bool pair_is_valid(simplif::Vertex *u, simplif::Vertex *v);
[1007]63       
[981]64        void simplifmethod_run(int,     Geometry::TIPOFUNC      upb=0);
[1007]65       
[981]66        void simplifmethod_runv(int,    Geometry::TIPOFUNC      upb=0);
[1007]67       
[981]68        void simplifmethod_init(void);
[774]69
[1007]70        //      To map the mesh with de simplification method structure.
71        //      Submeshes which pertains each vertex.
72        std::map<int,std::vector<int> > submeshmap;
73       
74        //      Vertices of the VertexBuffer that point
75        //      at this vertex of the simplification method.
76        std::map<int,std::vector<int> > vertexbuffermap;
[774]77
[1007]78        //      Simplification sequence of the simplification method.
[774]79        std::vector<Geometry::MeshSimplificationSequence::Step> decim_data;
[1007]80       
[774]81        std::string meshName;
[1007]82       
[774]83        void WriteOBJ(void);
[1007]84       
[774]85        unsigned int *first_index_submesh;
[1007]86       
[1025]87        //std::vector<simplif::pair_info *> pointers_to_remove;
[774]88
89        int indexMeshLeaves;
[1007]90       
[774]91public:
[1007]92       
[774]93        const Geometry::Mesh *objmesh;
[1007]94       
95        //      Total number of triangles of all the submeshes.
96        int number_of_triangles;
97       
[774]98        SimplificationMethod(const Geometry::Mesh *m);
[1007]99       
[774]100        void geomesh2simplifModel(void);
[1007]101       
102        Geometry::MeshSimplificationSequence *Decimate( float lod,
103                                                                                                                                                                                                        int simpliftype,
104                                                                                                                                                                                                        Geometry::TIPOFUNC      upb=0);
105       
[774]106        void setMeshLeaves(int meshLeaves);
107
[1007]108        ///     Gets mesh simplified.
[980]109        Geometry::Mesh  *       GetMesh();
110       
[774]111        ///Destructor
112        ~SimplificationMethod();
113};
[1007]114
Note: See TracBrowser for help on using the repository browser.