source: GTP/trunk/Lib/Geom/shared/GTGeometry/src/GeoMeshSimplifier.cpp @ 774

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

GTGeometry and GeoTool? initial imports

Line 
1#include "GeoMeshSimplifier.h"
2#include "GeoMeshSimpSequence.h"
3#include "SimplificationMethod.h"
4#include <iostream>
5#include <fstream>
6
7using namespace Geometry;
8using namespace std;
9
10MeshSimplifier::MeshSimplifier( const Geometry::Mesh    *m,
11                                                                                                                                Geometry::TIPOFUNC              upb)
12{
13        objmesh                                 =       m;
14        meshsalida                      =       NULL;
15        msimpsequence           =       NULL;
16        indexMeshLeaves =       -1;
17
18        //      Sets the actual progress bar function.
19        mUPB    =       upb;
20}
21
22MeshSimplifier::~MeshSimplifier()
23{
24        delete msimpsequence;
25}
26
27// Returns the simplified mesh.
28Geometry::Mesh *MeshSimplifier::GetMesh ()
29{
30        return meshsalida;
31}
32
33void MeshSimplifier::setMeshLeaves(Geometry::Index index)
34{
35        indexMeshLeaves =       index;
36}
37
38// Returns the simplification sequence for general meshes.
39Geometry::MeshSimplificationSequence *MeshSimplifier::GetSimplificationSequence()
40{
41        return msimpsequence;
42}
43
44ImageBasedSimplifier::ImageBasedSimplifier (const Geometry::Mesh        *m,
45                                                                                                                                                                                Geometry::TIPOFUNC              upb)
46                                                                                                                                                                                :MeshSimplifier(m,upb)
47{
48}
49
50ImageBasedSimplifier::~ImageBasedSimplifier()
51{
52}
53
54// 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.
55void ImageBasedSimplifier::Simplify (Geometry::Real paramlod)
56{
57        SimplificationMethod *m_qslim   =       new SimplificationMethod(objmesh);
58       
59        m_qslim->setMeshLeaves(indexMeshLeaves);
60       
61        msimpsequence   =       m_qslim->Decimate(paramlod,&meshsalida,0,mUPB);
62       
63        delete  m_qslim;
64}
65
66// 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.
67void ImageBasedSimplifier::Simplify (Geometry::uint32 numvertices)
68{
69        SimplificationMethod *m_qslim   =       new SimplificationMethod(objmesh);
70       
71        m_qslim->setMeshLeaves(indexMeshLeaves);
72       
73        msimpsequence   =       m_qslim->Decimate((float)numvertices,&meshsalida,1,mUPB);
74       
75        delete m_qslim;
76}
77
Note: See TracBrowser for help on using the repository browser.