Commit 76423b8d authored by Mike Kremer's avatar Mike Kremer

Added two new subdivision schemes (Interpolating Sqrt3 Labsik-Greiner and...

Added two new subdivision schemes (Interpolating Sqrt3 Labsik-Greiner and Modified Butterfly) to subdivider applications.

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@389 fdac6126-5c0c-442c-9429-916003d36597
parent 6dec1d36
......@@ -70,6 +70,8 @@
#include <OpenMesh/Tools/Subdivider/Uniform/CompositeSqrt3T.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/LoopT.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/Sqrt3T.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh>
// My stuff
#include <OpenMesh/Apps/Subdivider/SubdivideWidget.hh>
......@@ -144,20 +146,25 @@ SubdivideWidget(QWidget* _parent, const char* _name)
QRadioButton* radio1 = new QRadioButton( "Comp. Loop" );
QRadioButton* radio2 = new QRadioButton( "Comp. SQRT(3)" );
QRadioButton* radio3 = new QRadioButton( "Loop" );
QRadioButton* radio4 = new QRadioButton( "Sqrt(3)" );
QRadioButton* radio5 = new QRadioButton( "Interpolating Sqrt3" );
QRadioButton* radio6 = new QRadioButton( "Modified Butterfly" );
radio3->setChecked( TRUE );
sel_topo_type = SOP_UniformLoop;
QRadioButton* radio4 = new QRadioButton( "Sqrt(3)" );
buttonGroup->addButton(radio1, SOP_UniformCompositeLoop);
buttonGroup->addButton(radio2, SOP_UniformCompositeSqrt3);
buttonGroup->addButton(radio3, SOP_UniformLoop);
buttonGroup->addButton(radio4, SOP_UniformSqrt3);
buttonGroup->addButton(radio5, SOP_UniformInterpolatingSqrt3);
buttonGroup->addButton(radio6, SOP_ModifiedButterfly);
vbox->addWidget(radio1);
vbox->addWidget(radio2);
vbox->addWidget(radio3);
vbox->addWidget(radio4);
vbox->addWidget(radio5);
vbox->addWidget(radio6);
QObject::connect( buttonGroup, SIGNAL( buttonPressed(int) ),
this, SLOT( slot_select_sop(int) ) );
......@@ -178,10 +185,12 @@ SubdivideWidget(QWidget* _parent, const char* _name)
// --------------------
subdivider_[SOP_UniformCompositeLoop] = new Uniform::CompositeLoopT<Mesh>;
subdivider_[SOP_UniformCompositeSqrt3] = new Uniform::CompositeSqrt3T<Mesh>;
subdivider_[SOP_UniformLoop] = new Uniform::LoopT<Mesh>;
subdivider_[SOP_UniformSqrt3] = new Uniform::Sqrt3T<Mesh>;
subdivider_[SOP_UniformCompositeLoop] = new Uniform::CompositeLoopT<Mesh>;
subdivider_[SOP_UniformCompositeSqrt3] = new Uniform::CompositeSqrt3T<Mesh>;
subdivider_[SOP_UniformLoop] = new Uniform::LoopT<Mesh>;
subdivider_[SOP_UniformSqrt3] = new Uniform::Sqrt3T<Mesh>;
subdivider_[SOP_UniformInterpolatingSqrt3] = new Uniform::InterpolatingSqrt3LGT< Mesh >;
subdivider_[SOP_ModifiedButterfly] = new Uniform::ModifiedButterflyT<Mesh>;
}
......@@ -195,6 +204,8 @@ void SubdivideWidget::slot_select_sop(int i)
case SOP_UniformCompositeLoop:
case SOP_UniformCompositeSqrt3:
case SOP_UniformLoop:
case SOP_UniformInterpolatingSqrt3:
case SOP_ModifiedButterfly:
case SOP_UniformSqrt3: sel_topo_type = (SOPType)i; break;
default: sel_topo_type = SOP_Undefined;
}
......
......@@ -75,6 +75,8 @@ public:
SOP_UniformCompositeSqrt3,
SOP_UniformLoop,
SOP_UniformSqrt3,
SOP_UniformInterpolatingSqrt3,
SOP_ModifiedButterfly,
SOP_Undefined
};
......
......@@ -51,6 +51,8 @@
#include <OpenMesh/Tools/Subdivider/Uniform/LoopT.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/CompositeSqrt3T.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/CompositeLoopT.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/Sqrt3InterpolatingSubdividerLabsikGreinerT.hh>
#include <OpenMesh/Tools/Subdivider/Uniform/ModifiedButterFlyT.hh>
// ----------------------------------------------------------------------------
......@@ -64,6 +66,8 @@ typedef Uniform::Sqrt3T< Mesh > Sqrt3;
typedef Uniform::LoopT< Mesh > Loop;
typedef Uniform::CompositeSqrt3T< CMesh > CompositeSqrt3;
typedef Uniform::CompositeLoopT< CMesh > CompositeLoop;
typedef Uniform::InterpolatingSqrt3LGT< Mesh > InterpolatingSqrt3LG;
typedef Uniform::ModifiedButterflyT< Mesh > ModifiedButterfly;
using OpenMesh::Utils::Timer;
......@@ -189,12 +193,14 @@ int main(int argc, char **argv)
TypeSqrt3,
TypeLoop,
TypeCompSqrt3,
TypeCompLoop
TypeCompLoop,
TypeLabsikGreiner,
TypeModButterfly
} st = TypeSqrt3;
Timer::Format fmt = Timer::Automatic;
while ( (c=getopt(argc, argv, "csSlLhf:"))!=-1 )
while ( (c=getopt(argc, argv, "csSlLbBhf:"))!=-1 )
{
switch(c)
{
......@@ -203,6 +209,8 @@ int main(int argc, char **argv)
case 'S': st = TypeCompSqrt3; break;
case 'l': st = TypeLoop; break;
case 'L': st = TypeCompLoop; break;
case 'b': st = TypeLabsikGreiner; break;
case 'B': st = TypeModButterfly; break;
case 'f':
{
switch(*optarg)
......@@ -241,10 +249,12 @@ int main(int argc, char **argv)
if ( compare_all )
{
int rc;
rc = mainT<Sqrt3> ( n, ifname, "", fmt );
rc += mainT<Loop> ( n, ifname, "", fmt );
rc += mainT<CompositeSqrt3>( n, ifname, "", fmt );
rc += mainT<CompositeLoop> ( n, ifname, "", fmt );
rc = mainT<Sqrt3> ( n, ifname, "", fmt );
rc += mainT<Loop> ( n, ifname, "", fmt );
rc += mainT<CompositeSqrt3> ( n, ifname, "", fmt );
rc += mainT<CompositeLoop> ( n, ifname, "", fmt );
rc += mainT<InterpolatingSqrt3LG> ( n, ifname, "", fmt );
rc += mainT<ModifiedButterfly> ( n, ifname, "", fmt );
if (rc)
return rc;
......@@ -264,6 +274,9 @@ int main(int argc, char **argv)
<< std::endl
<< "loop : "
<< timings["Uniform Composite Loop"]/timings["Uniform Loop"]
<< std::endl
<< "Interpolating sqrt(3) : "
<< timings["Uniform Interpolating Sqrt3"]/timings["Uniform Sqrt3"]
<< std::endl;
return 0;
}
......@@ -277,6 +290,10 @@ int main(int argc, char **argv)
return mainT<CompositeSqrt3>( n, ifname, ofname, fmt );
case TypeCompLoop:
return mainT<CompositeLoop> ( n, ifname, ofname, fmt );
case TypeLabsikGreiner:
return mainT<InterpolatingSqrt3LG> ( n, ifname, ofname, fmt );
case TypeModButterfly:
return mainT<ModifiedButterfly> ( n, ifname, ofname, fmt );
}
return 1;
}
......@@ -293,6 +310,8 @@ void usage_and_exit(int _xcode)
<< " -L\tComposite Loop\n"
<< " -s\tSqrt3\n"
<< " -S\tComposite Sqrt3\n"
<< " -b\tInterpolating Sqrt3 Labsik-Greiner\n"
<< " -B\tModified Butterfly\n"
<< std::endl;
exit(_xcode);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment