-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathTopomender.cpp
More file actions
executable file
·76 lines (71 loc) · 2.13 KB
/
Topomender.cpp
File metadata and controls
executable file
·76 lines (71 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include "Topomender.h"
Topomender::Topomender(string meshStr,string sogStr,string sktStr,string outputStr)
{
m_strMeshFile = meshStr;
m_strSOGFile = sogStr;
m_strSktFile = sktStr;
m_strOutputFile = outputStr;
}
bool Topomender::testValid()
{
if(!(m_strMeshFile.substr(m_strMeshFile.length()-4) == ".obj")) return false;
if(!(m_strSOGFile.substr(m_strSOGFile.length()-4) == ".sog")) return false;
if(!(m_strSktFile.substr(m_strSktFile.length()-4) == ".axs")) return false;
if(!(m_strOutputFile.substr(m_strOutputFile.length()-4) == ".obj")) return false;
return true;
}
bool Topomender::Initialize()
{
m_pRenderMesh = new RenderMesh();
if(!m_pRenderMesh->LoadFrom(m_strMeshFile))
{
return false;
}
//if(!m_cOcTree.LoadFromSOG(m_strSOGFile)) return false;
if(!m_cSkeleton.LoadFrom(m_strSktFile)) {
return false;
}
m_cOcTree.m_cConstant.Initialize();
return true;
}
void Topomender::Go()
{
// load OcTree
OcTree * pInitOcTree = new OcTree();
if ( pInitOcTree->LoadFromSOG( m_strSOGFile ) == false ) {
delete pInitOcTree;
return;
}
pInitOcTree->m_cConstant.Initialize();
pInitOcTree->Sketching(& m_cSkeleton);
#ifdef OCTREE_LEVEL_RESTRICT
pInitOcTree->LevelRestrict();
#endif
pInitOcTree->SetStorages();
OcTree * pTempOcTree = new OcTree();
pTempOcTree->DuplicateOcTree(pInitOcTree);
delete pInitOcTree;
m_cOcTree.LoadFromOcTree( pTempOcTree );
delete pTempOcTree;
m_cOcTree.RecSketchingCheck(m_cOcTree.m_pRoot, 0, 0);
#ifdef CONSOLE_OUTPUT
m_cOcTree.PrintInfo();
m_cOcTree.m_cMemoryManager.PrintInfo();
printf("Initialization successfully.\n");
m_cOcTree.PrintSketchingInfo();
printf("\n========================== Thinning Process ============================\n");
#endif
m_cOcTree.m_bCleanSkeleton = true;
m_cOcTree.Thin();
m_cOcTree.DualThin();
m_cOcTree.PrintSkeletonInfo();
#ifdef CONSOLE_OUTPUT
printf("\n========================== Topology Repair =============================\n");
#endif
m_cOcTree.TopologyRepair();
// m_cOcTree.PrintSketchingInfo();
}
void Topomender::Contour()
{
m_cOcTree.Contouring( m_strOutputFile, m_strSOGFile );
}