This commit is contained in:
ganovelli 2012-10-19 15:08:37 +00:00
parent 60be67113d
commit afc883bfc1
14 changed files with 0 additions and 2257 deletions

View File

@ -1,76 +0,0 @@
#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>
// 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/algorithms/local_optimization.h>
#include <vcg/complex/algorithms/local_optimization/tetra_edge_collapse.h>
vcg::LocalOptimization<MyTMesh> *loc;
//vcg::tetra::TetraEdgeCollapse<MyTMesh> c;
MyTMesh mesh;
int main(int,char**argv,int num_op){
loc=new vcg::LocalOptimization<MyTMesh>(mesh);
vcg::tetra::io::ImporterTS<MyTMesh>::Open(mesh,argv[1]);
//vcg::tetra::io::ImporterTS<MyTMesh>::Open(mesh,"d:/sphere.ts");
printf("mesh loaded %d %d \n",mesh.vn,mesh.tn);
/*vcg::tetra::TetraEdgeCollapse<MyTMesh> *_ ;
bool res;*/
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);
vcg::tetra::TetraEdgeCollapse<MyTMesh>::Init(mesh,loc->h);
bool res;
do{
loc->SetTargetOperations(num_op);
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

@ -1,145 +0,0 @@
<?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;d:/;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="5"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<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"/>
<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"/>
<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"/>
<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\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>

View File

@ -1,619 +0,0 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>MainFrame</class>
<widget class="QMainWindow">
<property name="name">
<cstring>MainFrame</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>908</width>
<height>846</height>
</rect>
</property>
<property name="caption">
<string>TetraView</string>
</property>
<widget class="QGroupBox">
<property name="name">
<cstring>file</cstring>
</property>
<property name="geometry">
<rect>
<x>70</x>
<y>0</y>
<width>90</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string></string>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>OpenButton</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>70</width>
<height>60</height>
</rect>
</property>
<property name="text">
<string></string>
</property>
</widget>
</widget>
<widget class="QButtonGroup">
<property name="name">
<cstring>buttonGroup1</cstring>
</property>
<property name="geometry">
<rect>
<x>160</x>
<y>0</y>
<width>470</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string></string>
</property>
<property name="exclusive">
<bool>true</bool>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>BoxButton</cstring>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>51</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>box</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>WireButton</cstring>
</property>
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>40</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Wire</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>HiddenButton</cstring>
</property>
<property name="geometry">
<rect>
<x>130</x>
<y>30</y>
<width>60</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Hidden</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>FlatWireButton</cstring>
</property>
<property name="geometry">
<rect>
<x>260</x>
<y>30</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>FlatWire</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>SmoothButton</cstring>
</property>
<property name="geometry">
<rect>
<x>330</x>
<y>30</y>
<width>50</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Smooth</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>SmallTetraButton</cstring>
</property>
<property name="geometry">
<rect>
<x>390</x>
<y>30</y>
<width>60</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>SmallTetra</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>FlatButton</cstring>
</property>
<property name="geometry">
<rect>
<x>200</x>
<y>30</y>
<width>50</width>
<height>30</height>
</rect>
</property>
<property name="text">
<string>Flat</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
<property name="on">
<bool>true</bool>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
</widget>
<widget class="QButtonGroup">
<property name="name">
<cstring>buttonGroup2</cstring>
</property>
<property name="geometry">
<rect>
<x>630</x>
<y>0</y>
<width>230</width>
<height>80</height>
</rect>
</property>
<property name="title">
<string></string>
</property>
<property name="exclusive">
<bool>true</bool>
</property>
<widget class="QPushButton">
<property name="name">
<cstring>TrackButton</cstring>
</property>
<property name="geometry">
<rect>
<x>140</x>
<y>20</y>
<width>61</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Trackball</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
<property name="on">
<bool>true</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>SectionButton</cstring>
</property>
<property name="geometry">
<rect>
<x>40</x>
<y>20</y>
<width>71</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Section</string>
</property>
<property name="toggleButton">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="MyGLWidget">
<property name="name">
<cstring>myGLWidget</cstring>
</property>
<property name="geometry">
<rect>
<x>70</x>
<y>70</y>
<width>790</width>
<height>720</height>
</rect>
</property>
</widget>
</widget>
<menubar>
<property name="name">
<cstring>MenuBar</cstring>
</property>
<item text="&amp;File" name="File">
<action name="fileOpenAction"/>
<separator/>
<separator/>
<action name="fileExitAction"/>
</item>
<item text="&amp;Help" name="Help">
<action name="helpContentsAction"/>
<action name="helpIndexAction"/>
<separator/>
<action name="helpAboutAction"/>
</item>
<item text="Info" name="Info_2">
<action name="new_menunew_itemAction"/>
<action name="infoSimplexAction"/>
<action name="infoQualityAction"/>
<action name="infoPhysicsAction"/>
</item>
</menubar>
<toolbars>
</toolbars>
<customwidgets>
<customwidget>
<class>MyGLWidget</class>
<header location="global">D:/sf/apps/tetraviewer/myglwidget.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>0</container>
<sizepolicy>
<hordata>5</hordata>
<verdata>5</verdata>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<pixmap>image0</pixmap>
<signal>signal()</signal>
<slot access="public" specifier="">setBox()</slot>
<slot access="public" specifier="">setWire()</slot>
<slot access="public" specifier="">setHidden()</slot>
<slot access="public" specifier="">setFlat()</slot>
<slot access="public" specifier="">setFlatWire()</slot>
<slot access="public" specifier="">setSmallTetra()</slot>
<slot access="public" specifier="">setSmooth()</slot>
<slot access="public" specifier="">TrackMouseModality()</slot>
<slot access="public" specifier="">SectionMouseModality()</slot>
<slot access="public" specifier="">slot()</slot>
<slot access="public" specifier="">slot()</slot>
<slot access="public" specifier="">SwitchTextSimplex()</slot>
<slot access="public" specifier="">slot()</slot>
<slot access="public" specifier="">SwitchTextPhysics()</slot>
<slot access="public" specifier="">slot()</slot>
<slot access="public" specifier="">SwitchTextQuality()</slot>
</customwidget>
</customwidgets>
<actions>
<action>
<property name="name">
<cstring>fileOpenAction</cstring>
</property>
<property name="toggleAction">
<bool>false</bool>
</property>
<property name="on">
<bool>false</bool>
</property>
<property name="iconSet">
<iconset></iconset>
</property>
<property name="text">
<string>Open</string>
</property>
<property name="menuText">
<string>&amp;Open...</string>
</property>
<property name="accel">
<string>Ctrl+O</string>
</property>
</action>
<action>
<property name="name">
<cstring>fileExitAction</cstring>
</property>
<property name="text">
<string>Exit</string>
</property>
<property name="menuText">
<string>E&amp;xit</string>
</property>
<property name="accel">
<string></string>
</property>
</action>
<action>
<property name="name">
<cstring>helpContentsAction</cstring>
</property>
<property name="text">
<string>Contents</string>
</property>
<property name="menuText">
<string>&amp;Contents...</string>
</property>
<property name="accel">
<string></string>
</property>
</action>
<action>
<property name="name">
<cstring>helpIndexAction</cstring>
</property>
<property name="text">
<string>Index</string>
</property>
<property name="menuText">
<string>&amp;Index...</string>
</property>
<property name="accel">
<string></string>
</property>
</action>
<action>
<property name="name">
<cstring>helpAboutAction</cstring>
</property>
<property name="text">
<string>About</string>
</property>
<property name="menuText">
<string>&amp;About</string>
</property>
<property name="accel">
<string></string>
</property>
</action>
<action>
<property name="name">
<cstring>new_menunew_itemAction</cstring>
</property>
<property name="text">
<string></string>
</property>
<property name="menuText">
<string></string>
</property>
</action>
<action>
<property name="name">
<cstring>infoSimplexAction</cstring>
</property>
<property name="toggleAction">
<bool>true</bool>
</property>
<property name="on">
<bool>true</bool>
</property>
<property name="text">
<string>Simplex</string>
</property>
<property name="menuText">
<string>Simplex</string>
</property>
</action>
<action>
<property name="name">
<cstring>infoQualityAction</cstring>
</property>
<property name="toggleAction">
<bool>true</bool>
</property>
<property name="text">
<string>Quality</string>
</property>
<property name="menuText">
<string>Quality</string>
</property>
</action>
<action>
<property name="name">
<cstring>infoPhysicsAction</cstring>
</property>
<property name="toggleAction">
<bool>true</bool>
</property>
<property name="text">
<string>Physics</string>
</property>
<property name="menuText">
<string>Physics</string>
</property>
</action>
</actions>
<images>
<image name="image0">
<data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154789cad94514c5b5518c77fe7dc4b7b4b6150bb96324418ca32358bee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d6a78d0b027b3cd07d9e68c81c625a6c139408a4384f416100aed6d4b7bdb7b8e0fc0921a70c6ed7b3ae7e43bbff3fffedfc927e2f138bbd1dbdbab7902118fc785d8058f8d8de9aeae2e72b91cb66de338ce7f82e47239666767492412b8aefbf0dcdc553a323242f4501d918e2d3a8f15a9784584100809a609526eafd1a0f54e6142e029c5c21f3ef41583bb77a805efbe1ce9d86279e32619678eaab7853fa0f02a16abb64166ad0cdac75307eb3874b84cb0a14aa5a24108cc0688c48c9a4a1e826ddbe6f0b12219678e8ace610502ccdfafe3f68d3c33bf6c01c59dcc209d472c4e0d35d2f3ba81d205d06005e4de60c77170bd2255af80150870f70e8c0eaf009260a349577714e913a4175d16925b5cbe50607931cc3b677c68ca28a5f7066f5b26f00760febec9e8f032a0e81b68a17fc0201415989647a9d8c4c498cbe8f05f5cff3a4d4bac8bfe210b290b35e01afd428257b1b875cd01aaf4bd1de5dd0fea688e1530ad1c1bab16b7af17393558cf997311c0e49bafd670d6258621f6576c9ab09a3248fe5ae6c08103f49f36517213d33070369bf8e2529ee9c90ceb2b2eef7f14617c2c48722a4b7226845143fa87622905ebeb6514253a9eb5084504a66950c88618bee0303d99217cb09e9ed71a09369538fa523d00e9a50a42eed3bc6d8f41281fa0903e8561796cac86f8f2b33c33930ea0f0fb4d5adbeb30ad22866ffbbad226d2a805d7ee0484220208925aaa50deaa67e27b97e9c90ccdcdf5c462cdd8a94d2e7e62f3603244ea410989a4ed191f52a8fd156b056d9d553a9e0bf0e7ef45c6bf7339fd5e90ec7a88575e6d20d6e6e7e2a755ec854dce7fb8885b2cd014f6f3c2714d3a550bae55ac35c1068fb7061b00b87a7995899b25ce9e0b73e24d8fae97b37c7cbe9370b499fce6066eb54adf6098f6ee2a9a7ff9c70841a5023d270deca510d746537c7e29cdf8ad20475fb4307c82d4fc324ec6859d66fdfc6381e44014b36e9fe6e572393ca54068aa22cfd0598b686b3737aeae90bc9725796f0350802414b6e81b7c9a9f7e70708a2e6e5991cfeee3f1ecec2c0b0b3e8c068142a2a8d23728397132c6dc6f2e2b8b0a8da4b5ddc7f3c735ed47146f0cb4502983693a4c25ca7b83138904fa8a412466e00f48b4271086c2901263676c4a6990b615b6ade15b85694af239984a94585bf6f606bbae5b334f1f37e4a3531e031c8fc7c5a312ff17f849c3e3f1b8f81b8be6900aca9b61c90000000049454e44ae426082</data>
</image>
</images>
<connections>
<connection>
<sender>fileOpenAction</sender>
<signal>activated()</signal>
<receiver>MainFrame</receiver>
<slot>fileOpen()</slot>
</connection>
<connection>
<sender>helpAboutAction</sender>
<signal>activated()</signal>
<receiver>MainFrame</receiver>
<slot>helpAbout()</slot>
</connection>
<connection>
<sender>helpContentsAction</sender>
<signal>activated()</signal>
<receiver>MainFrame</receiver>
<slot>helpContents()</slot>
</connection>
<connection>
<sender>helpIndexAction</sender>
<signal>activated()</signal>
<receiver>MainFrame</receiver>
<slot>helpIndex()</slot>
</connection>
<connection>
<sender>BoxButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setBox()</slot>
</connection>
<connection>
<sender>WireButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setWire()</slot>
</connection>
<connection>
<sender>HiddenButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setHidden()</slot>
</connection>
<connection>
<sender>FlatButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setFlat()</slot>
</connection>
<connection>
<sender>FlatWireButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setFlatWire()</slot>
</connection>
<connection>
<sender>SmoothButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setSmooth()</slot>
</connection>
<connection>
<sender>SmallTetraButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>setSmallTetra()</slot>
</connection>
<connection>
<sender>OpenButton</sender>
<signal>clicked()</signal>
<receiver>MainFrame</receiver>
<slot>fileOpen()</slot>
</connection>
<connection>
<sender>SectionButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>SectionMouseModality()</slot>
</connection>
<connection>
<sender>TrackButton</sender>
<signal>pressed()</signal>
<receiver>myGLWidget</receiver>
<slot>TrackMouseModality()</slot>
</connection>
<connection>
<sender>infoPhysicsAction</sender>
<signal>activated()</signal>
<receiver>myGLWidget</receiver>
<slot>SwitchTextPhysics()</slot>
</connection>
<connection>
<sender>infoQualityAction</sender>
<signal>activated()</signal>
<receiver>myGLWidget</receiver>
<slot>SwitchTextQuality()</slot>
</connection>
<connection>
<sender>infoSimplexAction</sender>
<signal>activated()</signal>
<receiver>myGLWidget</receiver>
<slot>SwitchTextSimplex()</slot>
</connection>
<connection>
<sender>fileExitAction</sender>
<signal>activated()</signal>
<receiver>MainFrame</receiver>
<slot>close()</slot>
</connection>
</connections>
<includes>
<include location="local" impldecl="in implementation">MainFrame.ui.h</include>
</includes>
<slots>
<slot>fileNew()</slot>
<slot>fileOpen()</slot>
<slot>fileSave()</slot>
<slot>fileSaveAs()</slot>
<slot>fileExit()</slot>
<slot>helpIndex()</slot>
<slot>helpContents()</slot>
<slot>helpAbout()</slot>
<slot specifier="non virtual">setWire()</slot>
</slots>
<pixmapinproject/>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>myglwidget.h</includehint>
</includehints>
</UI>

View File

@ -1,64 +0,0 @@
#include <qapplication.h>
#include "mainframe.h"
#include <wrap\io_tetramesh\import_ts.h>
#include <wrap\io_tetramesh\import_ply.h>
#include <vcg\complex\tetramesh\update\topology.h>
#include <vcg\complex\tetramesh\update\bounding.h>
#include <vcg\complex\tetramesh\update\normal.h>
//#include <tetrastats.h>
#include "myglwidget.h"
MyTetraMesh TM;
MyTetraMesh *tm;
TetraStats<MyTetraMesh> Stats;
typedef vcg::tetra::io::ImporterTS<MyTetraMesh> ImpTS;
typedef vcg::tetra::UpdateTetraTopology<MyTetraMesh::VertexContainer ,MyTetraMesh::TetraContainer > UT;
typedef vcg::tetra::UpdateNormals<MyTetraMesh> UN;
typedef vcg::tetra::UpdateBounding<MyTetraMesh> UB;
//MainFrame *wp;
void openTetraMesh(const char* filename)
{
//opening the tetrahedral mesh
QString path=QString(filename);
QString ext =path.right(3);
TM=MyTetraMesh();
if (ext==".ts")
ImpTS::Open(TM,filename);
else
vcg::tetra::io::ImporterPLY<MyTetraMesh> ::Open(TM,filename);
UT::TTTopology(TM.vert,TM.tetra);
UT::ClearVTTopology(TM.vert,TM.tetra);
UT::VTTopology(TM.vert,TM.tetra);
UN::PerVertex(TM);
UB::Box(TM);
tm=&TM;
Stats.SetTetraMesh(tm);
Stats.Update();
}
int main( int argc, char ** argv )
{
tm=0;
QApplication a( argc, argv );
MainFrame w;
// wp=&w;
w.show();
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
return a.exec();
}

View File

@ -1,258 +0,0 @@
/****************************************************************************
** Form implementation generated from reading ui file 'MainFrame.ui'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The User Interface Compiler ($Id: mainframe.cpp,v 1.2 2004-10-04 18:45:48 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include "mainframe.h"
#include <qvariant.h>
#include "myglwidget.h"
#include <qgroupbox.h>
#include <qpushbutton.h>
#include <qbuttongroup.h>
#include <qlayout.h>
#include <qtooltip.h>
#include <qwhatsthis.h>
#include <qaction.h>
#include <qmenubar.h>
#include <qpopupmenu.h>
#include <qtoolbar.h>
#include <qimage.h>
#include <qpixmap.h>
#include "MainFrame.ui.h"
/*
* Constructs a MainFrame as a child of 'parent', with the
* name 'name' and widget flags set to 'f'.
*
*/
MainFrame::MainFrame( QWidget* parent, const char* name, WFlags fl )
: QMainWindow( parent, name, fl )
{
(void)statusBar();
if ( !name )
setName( "MainFrame" );
setCentralWidget( new QWidget( this, "qt_central_widget" ) );
file = new QGroupBox( centralWidget(), "file" );
file->setGeometry( QRect( 70, 0, 90, 80 ) );
OpenButton = new QPushButton( file, "OpenButton" );
OpenButton->setGeometry( QRect( 10, 10, 70, 60 ) );
OpenButton->setPixmap( QPixmap::fromMimeSource( "Open64.png" ) );
buttonGroup1 = new QButtonGroup( centralWidget(), "buttonGroup1" );
buttonGroup1->setGeometry( QRect( 160, 0, 470, 80 ) );
buttonGroup1->setExclusive( TRUE );
BoxButton = new QPushButton( buttonGroup1, "BoxButton" );
BoxButton->setGeometry( QRect( 10, 30, 51, 31 ) );
BoxButton->setToggleButton( TRUE );
WireButton = new QPushButton( buttonGroup1, "WireButton" );
WireButton->setGeometry( QRect( 80, 30, 40, 30 ) );
WireButton->setToggleButton( TRUE );
HiddenButton = new QPushButton( buttonGroup1, "HiddenButton" );
HiddenButton->setGeometry( QRect( 130, 30, 60, 31 ) );
HiddenButton->setToggleButton( TRUE );
FlatWireButton = new QPushButton( buttonGroup1, "FlatWireButton" );
FlatWireButton->setGeometry( QRect( 260, 30, 61, 31 ) );
FlatWireButton->setToggleButton( TRUE );
SmoothButton = new QPushButton( buttonGroup1, "SmoothButton" );
SmoothButton->setGeometry( QRect( 330, 30, 50, 30 ) );
SmoothButton->setToggleButton( TRUE );
SmallTetraButton = new QPushButton( buttonGroup1, "SmallTetraButton" );
SmallTetraButton->setGeometry( QRect( 390, 30, 60, 30 ) );
SmallTetraButton->setToggleButton( TRUE );
FlatButton = new QPushButton( buttonGroup1, "FlatButton" );
FlatButton->setGeometry( QRect( 200, 30, 50, 30 ) );
FlatButton->setToggleButton( TRUE );
FlatButton->setOn( TRUE );
FlatButton->setAutoDefault( FALSE );
FlatButton->setDefault( FALSE );
myGLWidget = new MyGLWidget( centralWidget(), "myGLWidget" );
myGLWidget->setGeometry( QRect( 70, 80, 790, 720 ) );
buttonGroup2 = new QButtonGroup( centralWidget(), "buttonGroup2" );
buttonGroup2->setGeometry( QRect( 630, 0, 230, 80 ) );
buttonGroup2->setExclusive( TRUE );
TrackButton = new QPushButton( buttonGroup2, "TrackButton" );
TrackButton->setGeometry( QRect( 140, 20, 61, 31 ) );
TrackButton->setToggleButton( TRUE );
TrackButton->setOn( TRUE );
TrackButton->setDefault( FALSE );
SectionButton = new QPushButton( buttonGroup2, "SectionButton" );
SectionButton->setGeometry( QRect( 40, 20, 71, 31 ) );
SectionButton->setToggleButton( TRUE );
// actions
fileNewAction = new QAction( this, "fileNewAction" );
fileNewAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileOpenAction = new QAction( this, "fileOpenAction" );
fileOpenAction->setToggleAction( FALSE );
fileOpenAction->setOn( FALSE );
fileOpenAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileSaveAction = new QAction( this, "fileSaveAction" );
fileSaveAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileSaveAsAction = new QAction( this, "fileSaveAsAction" );
filePrintAction = new QAction( this, "filePrintAction" );
filePrintAction->setIconSet( QIconSet( QPixmap::fromMimeSource( "" ) ) );
fileExitAction = new QAction( this, "fileExitAction" );
helpContentsAction = new QAction( this, "helpContentsAction" );
helpIndexAction = new QAction( this, "helpIndexAction" );
helpAboutAction = new QAction( this, "helpAboutAction" );
new_menunew_itemAction = new QAction( this, "new_menunew_itemAction" );
infonew_itemAction = new QAction( this, "infonew_itemAction" );
infoSimplexAction = new QAction( this, "infoSimplexAction" );
infoSimplexAction->setToggleAction( TRUE );
infoSimplexAction->setOn( TRUE );
infoQualityAction = new QAction( this, "infoQualityAction" );
infoQualityAction->setToggleAction( TRUE );
infoPhysicsAction = new QAction( this, "infoPhysicsAction" );
infoPhysicsAction->setToggleAction( TRUE );
// toolbars
// menubar
MenuBar = new QMenuBar( this, "MenuBar" );
File = new QPopupMenu( this );
fileNewAction->addTo( File );
fileOpenAction->addTo( File );
fileSaveAction->addTo( File );
fileSaveAsAction->addTo( File );
File->insertSeparator();
filePrintAction->addTo( File );
File->insertSeparator();
fileExitAction->addTo( File );
MenuBar->insertItem( QString(""), File, 1 );
Help = new QPopupMenu( this );
helpContentsAction->addTo( Help );
helpIndexAction->addTo( Help );
Help->insertSeparator();
helpAboutAction->addTo( Help );
MenuBar->insertItem( QString(""), Help, 2 );
Info_2 = new QPopupMenu( this );
new_menunew_itemAction->addTo( Info_2 );
infoSimplexAction->addTo( Info_2 );
infoQualityAction->addTo( Info_2 );
infoPhysicsAction->addTo( Info_2 );
MenuBar->insertItem( QString(""), Info_2, 3 );
languageChange();
resize( QSize(908, 846).expandedTo(minimumSizeHint()) );
clearWState( WState_Polished );
// signals and slots connections
connect( fileNewAction, SIGNAL( activated() ), this, SLOT( fileNew() ) );
connect( fileOpenAction, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
connect( fileSaveAction, SIGNAL( activated() ), this, SLOT( fileSave() ) );
connect( fileSaveAsAction, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
connect( helpAboutAction, SIGNAL( activated() ), this, SLOT( helpAbout() ) );
connect( helpContentsAction, SIGNAL( activated() ), this, SLOT( helpContents() ) );
connect( helpIndexAction, SIGNAL( activated() ), this, SLOT( helpIndex() ) );
connect( BoxButton, SIGNAL( pressed() ), myGLWidget, SLOT( setBox() ) );
connect( WireButton, SIGNAL( pressed() ), myGLWidget, SLOT( setWire() ) );
connect( HiddenButton, SIGNAL( pressed() ), myGLWidget, SLOT( setHidden() ) );
connect( FlatButton, SIGNAL( pressed() ), myGLWidget, SLOT( setFlat() ) );
connect( FlatWireButton, SIGNAL( pressed() ), myGLWidget, SLOT( setFlatWire() ) );
connect( SmoothButton, SIGNAL( pressed() ), myGLWidget, SLOT( setSmooth() ) );
connect( SmallTetraButton, SIGNAL( pressed() ), myGLWidget, SLOT( setSmallTetra() ) );
connect( OpenButton, SIGNAL( clicked() ), this, SLOT( fileOpen() ) );
connect( SectionButton, SIGNAL( pressed() ), myGLWidget, SLOT( SectionMouseModality() ) );
connect( TrackButton, SIGNAL( pressed() ), myGLWidget, SLOT( TrackMouseModality() ) );
connect( infoPhysicsAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextPhysics() ) );
connect( infoQualityAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextQuality() ) );
connect( infoSimplexAction, SIGNAL( activated() ), myGLWidget, SLOT( SwitchTextSimplex() ) );
}
/*
* Destroys the object and frees any allocated resources
*/
MainFrame::~MainFrame()
{
// no need to delete child widgets, Qt does it all for us
}
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void MainFrame::languageChange()
{
setCaption( tr( "TetraView" ) );
file->setTitle( QString::null );
OpenButton->setText( QString::null );
buttonGroup1->setTitle( QString::null );
BoxButton->setText( tr( "box" ) );
WireButton->setText( tr( "Wire" ) );
HiddenButton->setText( tr( "Hidden" ) );
FlatWireButton->setText( tr( "FlatWire" ) );
SmoothButton->setText( tr( "Smooth" ) );
SmallTetraButton->setText( tr( "SmallTetra" ) );
FlatButton->setText( tr( "Flat" ) );
buttonGroup2->setTitle( QString::null );
TrackButton->setText( tr( "Trackball" ) );
SectionButton->setText( tr( "Section" ) );
fileNewAction->setText( tr( "New" ) );
fileNewAction->setMenuText( tr( "&New" ) );
fileNewAction->setAccel( tr( "Ctrl+N" ) );
fileOpenAction->setText( tr( "Open" ) );
fileOpenAction->setMenuText( tr( "&Open..." ) );
fileOpenAction->setAccel( tr( "Ctrl+O" ) );
fileSaveAction->setText( tr( "Save" ) );
fileSaveAction->setMenuText( tr( "&Save" ) );
fileSaveAction->setAccel( tr( "Ctrl+S" ) );
fileSaveAsAction->setText( tr( "Save As" ) );
fileSaveAsAction->setMenuText( tr( "Save &As..." ) );
fileSaveAsAction->setAccel( QString::null );
filePrintAction->setText( tr( "Print" ) );
filePrintAction->setMenuText( tr( "&Print..." ) );
filePrintAction->setAccel( tr( "Ctrl+P" ) );
fileExitAction->setText( tr( "Exit" ) );
fileExitAction->setMenuText( tr( "E&xit" ) );
fileExitAction->setAccel( QString::null );
helpContentsAction->setText( tr( "Contents" ) );
helpContentsAction->setMenuText( tr( "&Contents..." ) );
helpContentsAction->setAccel( QString::null );
helpIndexAction->setText( tr( "Index" ) );
helpIndexAction->setMenuText( tr( "&Index..." ) );
helpIndexAction->setAccel( QString::null );
helpAboutAction->setText( tr( "About" ) );
helpAboutAction->setMenuText( tr( "&About" ) );
helpAboutAction->setAccel( QString::null );
new_menunew_itemAction->setText( QString::null );
new_menunew_itemAction->setMenuText( QString::null );
infonew_itemAction->setText( tr( "new item" ) );
infonew_itemAction->setMenuText( tr( "new item" ) );
infoSimplexAction->setText( tr( "Simplex" ) );
infoSimplexAction->setMenuText( tr( "Simplex" ) );
infoQualityAction->setText( tr( "Quality" ) );
infoQualityAction->setMenuText( tr( "Quality" ) );
infoPhysicsAction->setText( tr( "Physics" ) );
infoPhysicsAction->setMenuText( tr( "Physics" ) );
if (MenuBar->findItem(1))
MenuBar->findItem(1)->setText( tr( "&File" ) );
if (MenuBar->findItem(2))
MenuBar->findItem(2)->setText( tr( "&Help" ) );
if (MenuBar->findItem(3))
MenuBar->findItem(3)->setText( tr( "Info" ) );
}

View File

@ -1,92 +0,0 @@
/****************************************************************************
** Form interface generated from reading ui file 'MainFrame.ui'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The User Interface Compiler ($Id: mainframe.h,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#ifndef MAINFRAME_H
#define MAINFRAME_H
#include <qvariant.h>
#include <qpixmap.h>
#include <qmainwindow.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QSpacerItem;
class QAction;
class QActionGroup;
class QToolBar;
class QPopupMenu;
class MyGLWidget;
class QGroupBox;
class QPushButton;
class QButtonGroup;
class MainFrame : public QMainWindow
{
Q_OBJECT
public:
MainFrame( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel );
~MainFrame();
QGroupBox* file;
QPushButton* OpenButton;
QButtonGroup* buttonGroup1;
QPushButton* BoxButton;
QPushButton* WireButton;
QPushButton* HiddenButton;
QPushButton* FlatWireButton;
QPushButton* SmoothButton;
QPushButton* SmallTetraButton;
QPushButton* FlatButton;
MyGLWidget* myGLWidget;
QButtonGroup* buttonGroup2;
QPushButton* TrackButton;
QPushButton* SectionButton;
QMenuBar *MenuBar;
QPopupMenu *File;
QPopupMenu *Help;
QPopupMenu *Info_2;
QAction* fileNewAction;
QAction* fileOpenAction;
QAction* fileSaveAction;
QAction* fileSaveAsAction;
QAction* filePrintAction;
QAction* fileExitAction;
QAction* helpContentsAction;
QAction* helpIndexAction;
QAction* helpAboutAction;
QAction* new_menunew_itemAction;
QAction* infonew_itemAction;
QAction* infoSimplexAction;
QAction* infoQualityAction;
QAction* infoPhysicsAction;
public slots:
virtual void fileNew();
virtual void fileOpen();
virtual void fileSave();
virtual void fileSaveAs();
virtual void fileExit();
virtual void helpIndex();
virtual void helpContents();
virtual void helpAbout();
void setWire();
protected:
protected slots:
virtual void languageChange();
private:
QPixmap image0;
};
#endif // MAINFRAME_H

View File

@ -1,82 +0,0 @@
/****************************************************************************
** ui.h extension file, included from the uic-generated form implementation.
**
** If you want to add, delete, or rename functions or slots, use
** Qt Designer to update this file, preserving your code.
**
** You should not define a constructor or destructor in this file.
** Instead, write your code in functions called init() and destroy().
** These will automatically be called by the form's constructor and
** destructor.
*****************************************************************************/
#include <qfiledialog.h>
#include <qdir.h>
#include <qmessagebox.h>
extern void openTetraMesh(const char *);
void MainFrame::fileNew()
{
}
void MainFrame::fileOpen()
{
QString filename = QFileDialog::getOpenFileName(
"",
"Tetrahedral Meshes File (*.ts *.ply)",
this,
"open file dialog"
"Choose a TS Tetrahedral mesh file" );
if (filename!=NULL)
{
const char *path=filename.ascii();
openTetraMesh(path);
}
}
void MainFrame::fileSave()
{
}
void MainFrame::fileSaveAs()
{
}
void MainFrame::fileExit()
{
}
void MainFrame::helpIndex()
{
}
void MainFrame::helpContents()
{
}
void MainFrame::helpAbout()
{
}
void MainFrame::setWire()
{
}

View File

@ -1,128 +0,0 @@
/****************************************************************************\
** MainFrame meta object code from reading C++ file 'mainframe.h'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The Qt MOC ($Id: moc_mainframe.cpp,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#undef QT_NO_COMPAT
#include "mainframe.h"
#include <qmetaobject.h>
#include <qapplication.h>
#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.3.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
const char *MainFrame::className() const
{
return "MainFrame";
}
QMetaObject *MainFrame::metaObj = 0;
static QMetaObjectCleanUp cleanUp_MainFrame( "MainFrame", &MainFrame::staticMetaObject );
#ifndef QT_NO_TRANSLATION
QString MainFrame::tr( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MainFrame", s, c, QApplication::DefaultCodec );
else
return QString::fromLatin1( s );
}
#ifndef QT_NO_TRANSLATION_UTF8
QString MainFrame::trUtf8( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MainFrame", s, c, QApplication::UnicodeUTF8 );
else
return QString::fromUtf8( s );
}
#endif // QT_NO_TRANSLATION_UTF8
#endif // QT_NO_TRANSLATION
QMetaObject* MainFrame::staticMetaObject()
{
if ( metaObj )
return metaObj;
QMetaObject* parentObject = QMainWindow::staticMetaObject();
static const QUMethod slot_0 = {"fileNew", 0, 0 };
static const QUMethod slot_1 = {"fileOpen", 0, 0 };
static const QUMethod slot_2 = {"fileSave", 0, 0 };
static const QUMethod slot_3 = {"fileSaveAs", 0, 0 };
static const QUMethod slot_4 = {"fileExit", 0, 0 };
static const QUMethod slot_5 = {"helpIndex", 0, 0 };
static const QUMethod slot_6 = {"helpContents", 0, 0 };
static const QUMethod slot_7 = {"helpAbout", 0, 0 };
static const QUMethod slot_8 = {"setWire", 0, 0 };
static const QUMethod slot_9 = {"languageChange", 0, 0 };
static const QMetaData slot_tbl[] = {
{ "fileNew()", &slot_0, QMetaData::Public },
{ "fileOpen()", &slot_1, QMetaData::Public },
{ "fileSave()", &slot_2, QMetaData::Public },
{ "fileSaveAs()", &slot_3, QMetaData::Public },
{ "fileExit()", &slot_4, QMetaData::Public },
{ "helpIndex()", &slot_5, QMetaData::Public },
{ "helpContents()", &slot_6, QMetaData::Public },
{ "helpAbout()", &slot_7, QMetaData::Public },
{ "setWire()", &slot_8, QMetaData::Public },
{ "languageChange()", &slot_9, QMetaData::Protected }
};
metaObj = QMetaObject::new_metaobject(
"MainFrame", parentObject,
slot_tbl, 10,
0, 0,
#ifndef QT_NO_PROPERTIES
0, 0,
0, 0,
#endif // QT_NO_PROPERTIES
0, 0 );
cleanUp_MainFrame.setMetaObject( metaObj );
return metaObj;
}
void* MainFrame::qt_cast( const char* clname )
{
if ( !qstrcmp( clname, "MainFrame" ) )
return this;
return QMainWindow::qt_cast( clname );
}
bool MainFrame::qt_invoke( int _id, QUObject* _o )
{
switch ( _id - staticMetaObject()->slotOffset() ) {
case 0: fileNew(); break;
case 1: fileOpen(); break;
case 2: fileSave(); break;
case 3: fileSaveAs(); break;
case 4: fileExit(); break;
case 5: helpIndex(); break;
case 6: helpContents(); break;
case 7: helpAbout(); break;
case 8: setWire(); break;
case 9: languageChange(); break;
default:
return QMainWindow::qt_invoke( _id, _o );
}
return TRUE;
}
bool MainFrame::qt_emit( int _id, QUObject* _o )
{
return QMainWindow::qt_emit(_id,_o);
}
#ifndef QT_NO_PROPERTIES
bool MainFrame::qt_property( int id, int f, QVariant* v)
{
return QMainWindow::qt_property( id, f, v);
}
bool MainFrame::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
#endif // QT_NO_PROPERTIES

View File

@ -1,134 +0,0 @@
/****************************************************************************
** MyGLWidget meta object code from reading C++ file 'myglwidget.h'
**
** Created: Mon Oct 4 19:00:57 2004
** by: The Qt MOC ($Id: moc_myglwidget.cpp,v 1.1 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#undef QT_NO_COMPAT
#include "myglwidget.h"
#include <qmetaobject.h>
#include <qapplication.h>
#include <private/qucomextra_p.h>
#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
#error "This file was generated using the moc from 3.3.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
const char *MyGLWidget::className() const
{
return "MyGLWidget";
}
QMetaObject *MyGLWidget::metaObj = 0;
static QMetaObjectCleanUp cleanUp_MyGLWidget( "MyGLWidget", &MyGLWidget::staticMetaObject );
#ifndef QT_NO_TRANSLATION
QString MyGLWidget::tr( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MyGLWidget", s, c, QApplication::DefaultCodec );
else
return QString::fromLatin1( s );
}
#ifndef QT_NO_TRANSLATION_UTF8
QString MyGLWidget::trUtf8( const char *s, const char *c )
{
if ( qApp )
return qApp->translate( "MyGLWidget", s, c, QApplication::UnicodeUTF8 );
else
return QString::fromUtf8( s );
}
#endif // QT_NO_TRANSLATION_UTF8
#endif // QT_NO_TRANSLATION
QMetaObject* MyGLWidget::staticMetaObject()
{
if ( metaObj )
return metaObj;
QMetaObject* parentObject = QGLWidget::staticMetaObject();
static const QUMethod slot_0 = {"setBox", 0, 0 };
static const QUMethod slot_1 = {"setWire", 0, 0 };
static const QUMethod slot_2 = {"setHidden", 0, 0 };
static const QUMethod slot_3 = {"setFlat", 0, 0 };
static const QUMethod slot_4 = {"setFlatWire", 0, 0 };
static const QUMethod slot_5 = {"setSmooth", 0, 0 };
static const QUMethod slot_6 = {"setSmallTetra", 0, 0 };
static const QUMethod slot_7 = {"TrackMouseModality", 0, 0 };
static const QUMethod slot_8 = {"SectionMouseModality", 0, 0 };
static const QUMethod slot_9 = {"SwitchTextSimplex", 0, 0 };
static const QUMethod slot_10 = {"SwitchTextPhysics", 0, 0 };
static const QUMethod slot_11 = {"SwitchTextQuality", 0, 0 };
static const QMetaData slot_tbl[] = {
{ "setBox()", &slot_0, QMetaData::Public },
{ "setWire()", &slot_1, QMetaData::Public },
{ "setHidden()", &slot_2, QMetaData::Public },
{ "setFlat()", &slot_3, QMetaData::Public },
{ "setFlatWire()", &slot_4, QMetaData::Public },
{ "setSmooth()", &slot_5, QMetaData::Public },
{ "setSmallTetra()", &slot_6, QMetaData::Public },
{ "TrackMouseModality()", &slot_7, QMetaData::Public },
{ "SectionMouseModality()", &slot_8, QMetaData::Public },
{ "SwitchTextSimplex()", &slot_9, QMetaData::Public },
{ "SwitchTextPhysics()", &slot_10, QMetaData::Public },
{ "SwitchTextQuality()", &slot_11, QMetaData::Public }
};
metaObj = QMetaObject::new_metaobject(
"MyGLWidget", parentObject,
slot_tbl, 12,
0, 0,
#ifndef QT_NO_PROPERTIES
0, 0,
0, 0,
#endif // QT_NO_PROPERTIES
0, 0 );
cleanUp_MyGLWidget.setMetaObject( metaObj );
return metaObj;
}
void* MyGLWidget::qt_cast( const char* clname )
{
if ( !qstrcmp( clname, "MyGLWidget" ) )
return this;
return QGLWidget::qt_cast( clname );
}
bool MyGLWidget::qt_invoke( int _id, QUObject* _o )
{
switch ( _id - staticMetaObject()->slotOffset() ) {
case 0: setBox(); break;
case 1: setWire(); break;
case 2: setHidden(); break;
case 3: setFlat(); break;
case 4: setFlatWire(); break;
case 5: setSmooth(); break;
case 6: setSmallTetra(); break;
case 7: TrackMouseModality(); break;
case 8: SectionMouseModality(); break;
case 9: SwitchTextSimplex(); break;
case 10: SwitchTextPhysics(); break;
case 11: SwitchTextQuality(); break;
default:
return QGLWidget::qt_invoke( _id, _o );
}
return TRUE;
}
bool MyGLWidget::qt_emit( int _id, QUObject* _o )
{
return QGLWidget::qt_emit(_id,_o);
}
#ifndef QT_NO_PROPERTIES
bool MyGLWidget::qt_property( int id, int f, QVariant* v)
{
return QGLWidget::qt_property( id, f, v);
}
bool MyGLWidget::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
#endif // QT_NO_PROPERTIES

View File

@ -1,13 +0,0 @@
#include <vcg\simplex\vertex\with\atvn.h>
#include <vcg\simplex\tetrahedron\with\atav.h>
#include <vcg\complex\tetramesh\base.h>
class MyTetrahedron;
class DUMMYEDGETYPE;
class DUMMYFACETYPE;
class MyVertex: public vcg::VertexATVNd<DUMMYEDGETYPE,DUMMYFACETYPE,MyTetrahedron>{};
class MyTetrahedron: public vcg::TetraATAV<MyVertex,MyTetrahedron>{};
typedef vcg::tetra::Tetramesh< std::vector<MyVertex> ,std::vector<MyTetrahedron> > MyTetraMesh;

View File

@ -1,394 +0,0 @@
#include "myglwidget.h"
#include <vcg\space\tetra3.h>
#include <vcg\space\point3.h>
#include "mainframe.h"
extern MyTetraMesh *tm;
extern TetraStats<MyTetraMesh> Stats;
//extern MainFrame *wp;
bool MyGLWidget::ShowTextSimplex()
{
return (_ShowBar & SIMPLEX);
}
bool MyGLWidget::ShowTextPhysics()
{
return (_ShowBar & PHYSICS);
}
bool MyGLWidget::ShowTextQuality()
{
return (_ShowBar & QUALITY);
}
MyGLWidget::MyGLWidget( QWidget * parent, const char * name, const QGLWidget * shareWidget, WFlags f ):
QGLWidget(parent, name)
{
Track.Reset();
Track.radius= 1;
WT=0;
modality=3;
mouse_modality=MMTrackball;
_ShowBar=SIMPLEX;
grabKeyboard();
}
void MyGLWidget::DrawTextInfo()
{
glPushAttrib(0xffffffff);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_SRC_ALPHA);
glEnable(GL_LIGHTING);
glEnable(GL_NORMALIZE);
glEnable(GL_COLOR_MATERIAL);
glDisable(GL_CLIP_PLANE0);
glColor4d(0.7,0,0.7,0.6);
glDepthRange(0.0,0.1);
glBegin(GL_QUADS);
glVertex3d(-0.5,-0.5,0);
glVertex3d(-0.5,-0.3,0);
glVertex3d(0.5,-0.3,0);
glVertex3d(0.5,-0.5,0);
glEnd();
if (Stats.TCurrent()!=0)
{
glBegin(GL_QUADS);
glVertex3d(0.25,0.5,0);
glVertex3d(0.5,0.5,0);
glVertex3d(0.5,0.2,0);
glVertex3d(0.25,0.2,0);
glEnd();
}
renderText( (width() - 10) / 2, 15, "a" );
QFont f( "arial", 12 );
QFontMetrics fmc( f );
glColor3d(1,1,1);
QString str="";
int level=0;
glDisable( GL_LIGHTING );
glDisable( GL_TEXTURE_2D );
if (ShowTextSimplex())
{
level++;
str.sprintf( "Tetrahedrons : %i Vertex: %i ",tm->tn,tm->vn);
renderText( 20, height() - level*20, str, f );
}
if (ShowTextPhysics())
{
level++;
str.sprintf( "Volume : %03f ",Stats.volume);
renderText( 20, height() - level*20, str, f );
}
if (ShowTextQuality())
{
level++;
str.sprintf( "Aspect Ratio : %03f ",Stats.ratio);
renderText( 20, height() - level*20, str, f );
}
//at the end i draw the window for informations about a tretrahedron
if (Stats.TCurrent()!=0)
{
str="";
str.sprintf( "Volume : %03f ",Stats.TCurrent()->ComputeVolume());
renderText( width()-150, 30, str, f );
str.sprintf( "Aspect Ratio : %03f ",Stats.TCurrent()->AspectRatio());
renderText( width()-150, 50, str, f );
LoadMatrix();
glColor3d(1,0,0);
glDisable(GL_BLEND);
//write values of the tetrahedron
for (int i=0;i<4;i++)
{
double x=Stats.TCurrent()->V(i)->P().V(0);//x value of vertex
double y=Stats.TCurrent()->V(i)->P().V(1);//y value of vertex
double z=Stats.TCurrent()->V(i)->P().V(2);//z value of vertex
str.sprintf("%i",i);
renderText(x,y,z,str,f);
}
Stats.TCurrent()->SetS();
}
glPopAttrib();
}
void MyGLWidget::DrawBox()
{
glPushAttrib(0xffffffff);
glDisable(GL_COLOR_MATERIAL);
glDisable(GL_LIGHT0);
glDisable(GL_LIGHTING);
glDisable(GL_NORMALIZE);
glColor3d(1,1,1);
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(0));
glVertex(tm->bbox.P(1));
glVertex(tm->bbox.P(3));
glVertex(tm->bbox.P(2));
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(4));
glVertex(tm->bbox.P(5));
glVertex(tm->bbox.P(7));
glVertex(tm->bbox.P(6));
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(0));
glVertex(tm->bbox.P(1));
glVertex(tm->bbox.P(5));
glVertex(tm->bbox.P(4));
glEnd();
glBegin(GL_LINE_LOOP);
glVertex(tm->bbox.P(3));
glVertex(tm->bbox.P(2));
glVertex(tm->bbox.P(6));
glVertex(tm->bbox.P(7));
glEnd();
glPopAttrib();
}
void MyGLWidget::DrawTetraMesh()
{
switch (modality)
{
case 0:DrawBox();break;
case 1:WT->Draw<vcg::GLW::DMWire,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 2:WT->Draw<vcg::GLW::DMHidden,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 3:WT->Draw<vcg::GLW::DMFlat,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 4:WT->Draw<vcg::GLW::DMFlatWire,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
case 5:WT->Draw<vcg::GLW::DMFlat,vcg::GLW::NMSmooth,vcg::GLW::CMNone>();break;
case 6:WT->Draw<vcg::GLW::DMSmallTetra,vcg::GLW::NMFlat,vcg::GLW::CMNone>();break;
}
}
void MyGLWidget::SaveMatrix()
{
glGetDoublev(GL_PROJECTION_MATRIX ,projection);
glGetDoublev(GL_MODELVIEW_MATRIX ,modelMatrix);
}
void MyGLWidget::LoadMatrix()
{
glMatrixMode(GL_PROJECTION);
glLoadMatrixd(projection);
glMatrixMode(GL_MODELVIEW);
glLoadMatrixd(modelMatrix);
}
void MyGLWidget::glDraw(){
glClearColor(0.2,0.2,0.2,1);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,1,0.01,20);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0,0,1,0,0,0,0,10,0);
if (tm!=0){
glPushMatrix();
glScalef(1/tm->bbox.Diag(),1/tm->bbox.Diag(),1/tm->bbox.Diag());
Track.GetView();
Track.Apply();
Track.Draw();
vcg::Point3d p=tm->bbox.Center();
glTranslate(-p);
//if not exist crete an instance of wrapper
if (WT==0)
{
WT= new vcg::GLWrapTetra<std::vector<MyTetrahedron> >(tm->tetra);
WT->SetHint(vcg::GLW::HShrinkFactor, 0.8);
}
/*glGetDoublev(GL_PROJECTION_MATRIX,proj);
glGetDoublev(GL_mode_MATRIX,mod);
glGetDoublev(GL_PROJECTION_MATRIX,);*/
SaveMatrix();
DrawTetraMesh();
glPopMatrix();
DrawTextInfo();
}
QGLWidget::glDraw();
}
void MyGLWidget::resizeGL( int w, int h )
{
// setup viewport, projection etc.:
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
float ratio=(float)w/(float)h;
gluPerspective(45,ratio,1,20);
_W=w;
_H=h;
glViewport (0, 0, (GLsizei) w, (GLsizei) h);
glMatrixMode (GL_MODELVIEW);
repaint();
}
void MyGLWidget::mousePressEvent ( QMouseEvent * e )
{
if (e->button()==Qt::LeftButton)
{
MyTetraMesh::TetraIterator ti;
int face;
switch(mouse_modality)
{
case MMTrackball:
Track.MouseDown(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
break;
case MMSection:
LoadMatrix();
vcg::GLPickTetra<MyTetraMesh>::PickNearestTetraFace(e->x(),_H-e->y(),*tm,ti,face);
if (ti!=0)
{
///find external face
/*while (!ti->IsBorderF(face))
face++;*/
/*ti->SetS();*/
vcg::Point3d p0=ti->V(vcg::Tetra::VofF(face,0))->P();
vcg::Point3d p1=ti->V(vcg::Tetra::VofF(face,1))->P();
vcg::Point3d p2=ti->V(vcg::Tetra::VofF(face,2))->P();
//put the trackball on the barycenter of the face
MyTetraMesh::VertexType::CoordType b=(p0+p1+p2)/3.f;
WT->AddClipSection(p0,p1,p2);
TrackClip.Reset();
TrackClip.radius=1;
TrackClip.center.V(0)=(float)b.V(0);
TrackClip.center.V(1)=(float)b.V(1);
TrackClip.center.V(2)=(float)b.V(2);
mouse_modality=MMNavigateSection;
TrackClip.MouseDown(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
}
break;
case MMNavigateSection:
TrackClip.MouseDown(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
break;
}
}
else if (e->button()==Qt::RightButton)
{
MyTetraMesh::TetraIterator ti;
LoadMatrix();
WT->section.GlClip();
vcg::GLPickTetra<MyTetraMesh>::PickNearestTetra(e->x(),_H-e->y(),*tm,ti);
if (ti!=0)
{
Stats.SetTetraInfo(&*ti);
}
}
repaint();
}
void MyGLWidget::mouseReleaseEvent(QMouseEvent * e )
{
Track.MouseUp(e->x(),_H-e->y(),vcg::Trackball::BUTTON_LEFT);
repaint();
}
void MyGLWidget::mouseMoveEvent ( QMouseEvent * e )
{
if (mouse_modality==MMTrackball)
{
Track.MouseMove(e->x(),_H-e->y());
repaint();
}
else
if ((mouse_modality==MMNavigateSection)&&(e->state() & Qt::LeftButton))
{
LoadMatrix();
TrackClip.MouseMove(e->x(),_H-e->y());
TrackClip.GetView();
TrackClip.Apply();
WT->section.Transform(TrackClip.track.Matrix());
repaint();
}
}
void MyGLWidget::wheelEvent ( QWheelEvent * e ){
/*
if (mouse_modality==MMTrackball)
{
const int WHEEL_DELTA =120;
Track.MouseWheel( e->delta()/ float(WHEEL_DELTA) );
repaint();
}else*/
if (mouse_modality==MMNavigateSection)
{
const int WHEEL_DELTA =120;
float delta= e->delta()/ float(WHEEL_DELTA);
WT->section.Translate(delta/10);
///for casting from double to float
TrackClip.center.V(0)=(float)WT->section.P.V(0);
TrackClip.center.V(1)=(float)WT->section.P.V(1);
TrackClip.center.V(2)=(float)WT->section.P.V(2);
repaint();
}
}
void MyGLWidget::keyPressEvent(QKeyEvent *k)
{
if (k->key()==Qt::Key_Escape)//&&((mouse_modality==MMNavigateSection)||(mouse_modality==MMSection)))
{
mouse_modality=MMTrackball;
WT->ClearClipSection();
}
}
void MyGLWidget::initializeGL(){
GLfloat f[4]={0.2,0.2,0.2,1.f};
GLfloat p[4]={3,3,5,0};
glLightfv(GL_LIGHT0, GL_AMBIENT,f);
glLightfv(GL_LIGHT1, GL_POSITION,p);
glLightfv(GL_LIGHT1, GL_DIFFUSE,f);
glLightfv(GL_LIGHT1, GL_SPECULAR,f);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glPolygonMode(GL_FRONT,GL_FILL);
glEnable(GL_BACK);
glCullFace(GL_BACK);
}

View File

@ -1,151 +0,0 @@
#include <GL/glew.h>
#include <qgl.h>
#include <wrap/gl/glwraptetra.h>
#include <wrap/gl/pick.h>
#include <wrap/gui/trackball.h>
#include "myclasses.h"
#include "tetrastats.h"
class MyGLWidget: public QGLWidget{
Q_OBJECT
private :
int _H;
int _W;
vcg::Trackball Track;
vcg::GLWrapTetra<MyTetraMesh::TetraContainer > *WT;
GLdouble projection[16];
GLdouble modelMatrix[16];
GLint viewport[4];
int modality;//rendering modality
enum mousemod {MMTrackball, MMSection,MMNavigateSection};//modality of using mouse
mousemod mouse_modality;
vcg::Trackball TrackClip;
/// This are the flags pf info of the mesh that we want to show
int _ShowBar;
enum {
SIMPLEX = 0x00000001, // show vertex number and tetrahedrons number
PHYSICS = 0x00000002, // show also physical information about the mesh
QUALITY = 0x00000004, // show informations about aspect ratio
};
public:
MyGLWidget( QWidget * parent = 0, const char * name = 0, const QGLWidget * shareWidget = 0, WFlags f = 0 );
virtual void glDraw();
void resizeGL( int w, int h );
virtual void mousePressEvent ( QMouseEvent * e );
virtual void mouseReleaseEvent(QMouseEvent * e );
virtual void mouseMoveEvent ( QMouseEvent * e );
virtual void wheelEvent ( QWheelEvent * e );
virtual void keyPressEvent(QKeyEvent *k);
virtual void initializeGL();
virtual void SaveMatrix();
void DrawTetraMesh();
void DrawBox();
bool ShowTextSimplex();
bool ShowTextPhysics();
bool ShowTextQuality();
void DrawTextInfo();
void LoadMatrix();
public slots:
///bounding box visualization modality
void setBox(){
modality=0;
repaint();
};
///wireframe modality
void setWire(){
modality=1;
repaint();
};
///hiddenlines modality
void setHidden(){
modality=2;
repaint();
};
///alternate wire visualization
void setFlat(){
modality=3;
repaint();
};
///alternate wire visualization
void setFlatWire(){
modality=4;
repaint();
};
///alternate wire visualization
void setSmooth(){
modality=5;
repaint();
};
///alternate wire visualization
void setSmallTetra()
{
modality=6;
repaint();
};
//set trackball modality
void TrackMouseModality()
{
mouse_modality=MMTrackball;
};
//set trackball modality
void SectionMouseModality()
{
mouse_modality=MMSection;
};
///switching to modality of viewing txt info on simplex
void SwitchTextSimplex()
{
if (ShowTextSimplex())
_ShowBar&=~SIMPLEX;
else
_ShowBar|=SIMPLEX;
repaint();
};
///switching to modality of viewing txt info on physics
void SwitchTextPhysics()
{
if (ShowTextPhysics())
_ShowBar&=~PHYSICS;
else
_ShowBar|=PHYSICS;
repaint();
};
///switching to modality of viewing txt info on quality
void SwitchTextQuality()
{
if (ShowTextQuality())
_ShowBar&=~QUALITY;
else
_ShowBar|=QUALITY;
repaint();
};
};

View File

@ -1,27 +0,0 @@
/****************************************************************************
** Image collection for project 'TetraView'.
**
** Generated from reading image files:
** images/editcopy
** images/editcut
** images/editpaste
** images/filenew
** images/fileopen
** images/filesave
** images/print
** images/redo
** images/searchfind
** images/undo
** images/Open64.png
**
** Created: Mon Oct 4 19:00:57 2004
** by: The User Interface Compiler ($Id: qmake_image_collection.cpp,v 1.3 2004-10-04 18:01:36 ganovelli Exp $)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/
#include <qimage.h>
#include <qdict.h>
#include <qmime.h>
#include <qdragobject.h>

View File

@ -1,74 +0,0 @@
template<class TETRA_MESH_TYPE>
class TetraStats
{
typedef typename TETRA_MESH_TYPE::TetraType TetraType;
TETRA_MESH_TYPE * Tetra;
TetraType* T;
public:
double volume;
double ratio;
TetraStats(){T=0;}
~TetraStats(){}
static double ComputeVolume(TETRA_MESH_TYPE *tm)
{
double total=0.f;
TETRA_MESH_TYPE::TetraIterator ti;
for (ti=tm->tetra.begin();ti<tm->tetra.end();ti++)
{
if (!ti->IsD())
total+=ti->ComputeVolume();
}
return total;
}
static double ComputeRatioMedia(TETRA_MESH_TYPE *tm)
{
double total=0.f;
TETRA_MESH_TYPE::TetraIterator ti;
int i=0;
for (ti=tm->tetra.begin();ti<tm->tetra.end();ti++)
{
if (!ti->IsD())
{
total+=ti->AspectRatio();
i++;
}
}
return (total/i);
}
void SetTetraMesh(TETRA_MESH_TYPE* T)
{
Tetra=T;
}
void Update()
{
ratio=ComputeRatioMedia(Tetra);
volume=ComputeVolume(Tetra);
}
void SetTetraInfo(TetraType *Te)
{
if (T!=0)
T->ClearS();
T=Te;
}
void ClearTetraInfo(TetraType *Te)
{
T=0;
}
TetraType * TCurrent()
{
return T;
}
};