first draft created

This commit is contained in:
ganovelli 2004-07-13 15:55:45 +00:00
parent 96e07ffd53
commit 5e9d001b2f
2 changed files with 249 additions and 0 deletions

View File

@ -0,0 +1,82 @@
#include <vector>
// stuff to define the mesh
#include <vcg/simplex/vertex/with/atvmvn.h>
#include <vcg/complex/tetramesh/base.h>
#include <vcg/simplex/tetrahedron/with/atavtq.h>
// the trackball
#include <wrap/gui/trackball.h>
// io
#include <wrap/io_tetramesh/import_ply.h>
#include <wrap/io_tetramesh/export_ply.h>
#include <wrap/io_tetramesh/import_ts.h>
class MyEdge;
class MyTetrahedron;
class MyFace;
class MyVertex:public vcg::VertexATVMVNf<DUMMYEDGETYPE , MyFace, MyTetrahedron>{} ;
class MyTetrahedron : public vcg::TetraATAVTQ<MyVertex,MyTetrahedron>{};
class MyTMesh: public vcg::tetra::Tetramesh< std::vector<MyVertex>, std::vector<MyTetrahedron > >{};
#include <vcg/complex/local_optimization/base.h>
#include <vcg/complex/local_optimization/tetra_edge_collapse.h>
vcg::LocalOptimization<MyTMesh> loc;
vcg::tetra::TetraEdgeCollapse<MyTMesh> c;
MyTMesh mesh;
int main(int,char**argv){
loc.m = & mesh;
vcg::tetra::io::ImporterTS<MyTMesh>::Open(mesh,argv[1]);
printf("mesh loaded %d %d \n",mesh.vn,mesh.tn);
// vcg::tetra::io::ExporterPLY<MyTMesh>::Save(mesh,(string(argv[1])+string(".ply")).c_str());
vcg::tetra::TetraEdgeCollapse<MyTMesh> *_ ;
bool res;
do{
vcg::tetra::UpdateTetraTopology<MyTMesh::VertexContainer,MyTMesh::TetraContainer>
::VTTopology(mesh.vert,mesh.tetra);
vcg::tetra::UpdateTetraTopology<MyTMesh::VertexContainer,MyTMesh::TetraContainer>
::TTTopology(mesh.vert,mesh.tetra);
vcg::tetra::UpdateTetraTopology<MyTMesh::VertexContainer,MyTMesh::TetraContainer>
::setExternalVertices(mesh.vert,mesh.tetra);
_=new vcg::tetra::TetraEdgeCollapse<MyTMesh>();
loc.h.push_back(vcg::LocalOptimization<MyTMesh>::HeapElem(_));
loc.Init();
loc.SetTargetSimplices(10);
res = loc.DoOptimization();
printf("ood %d\n bor %d\n vol %d \n lkv %d \n lke %d \n lkf %d \n",
FAIL::OFD(),
FAIL::BOR(),
FAIL::VOL(),
FAIL::LKV(),
FAIL::LKE(),
FAIL::LKF()
);
printf("mesh %d %d \n",mesh.vn,mesh.tn);
}while(!res);
vcg::tetra::io::ExporterPLY<MyTMesh>::Save(mesh,"out.ply");
return 0;
}

View File

@ -0,0 +1,167 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="tetra_decimator"
ProjectGUID="{50882E8E-9870-44A2-8038-2932E460C872}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
EnableIntrinsicFunctions="FALSE"
AdditionalIncludeDirectories="d:/sf"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4">
<IntelOptions
Optimization="0"
EnableIntrinsicFunctions="0"
MinimalRebuild="1"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
AllOptions="/c /I &quot;d:/sf&quot; /ZI /nologo /W3 /Wp64 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /Gm /EHsc /RTC1 /MLd /Fo&quot;Debug/&quot; /Fd&quot;Debug/vc70.pdb&quot; /Gd /TP"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/tetra_decimator.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/tetra_decimator.pdb"
SubSystem="1"
TargetMachine="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;Debug/tetra_decimator.exe&quot; /INCREMENTAL /DEBUG /PDB:&quot;Debug/tetra_decimator.pdb&quot; /SUBSYSTEM:CONSOLE /TLBID:1 /MACHINE:IX86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="4"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3">
<IntelOptions
RuntimeLibrary="4"
AllOptions="/c /Zi /nologo /W3 /Wp64 /O2 /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_CONSOLE&quot; /D &quot;_MBCS&quot; /FD /EHsc /ML /Fo&quot;Release/&quot; /Fd&quot;Release/vc70.pdb&quot; /Gd /TP"/>
</Tool>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/tetra_decimator.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
SubSystem="1"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1">
<IntelOptions
AllOptions="/NOLOGO /OUT:&quot;Release/tetra_decimator.exe&quot; /INCREMENTAL:NO /DEBUG /PDB:&quot;Release/tetra_decimator.pdb&quot; /SUBSYSTEM:CONSOLE /OPT:REF /OPT:ICF /TLBID:1 /MACHINE:IX86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
</Tool>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\main.cpp">
</File>
<File
RelativePath="..\..\..\wrap\ply\plylib.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\..\..\vcg\complex\local_optimization\base.h">
</File>
<File
RelativePath="..\..\..\vcg\complex\tetramesh\edge_collapse.h">
</File>
<File
RelativePath="..\..\..\vcg\complex\local_optimization\tetra_edge_collapse.h">
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>