Add LSCM as parametrization method

This commit is contained in:
Andreas Fabri 2015-03-10 10:44:57 +01:00
parent 2a244028a2
commit af7fa2ac51
2 changed files with 26 additions and 5 deletions

View File

@ -37,7 +37,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>978</width> <width>978</width>
<height>21</height> <height>26</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
@ -94,6 +94,7 @@
</property> </property>
<addaction name="actionMVC"/> <addaction name="actionMVC"/>
<addaction name="actionDCP"/> <addaction name="actionDCP"/>
<addaction name="actionLSC"/>
</widget> </widget>
<widget class="QMenu" name="menuPCA"> <widget class="QMenu" name="menuPCA">
<property name="title"> <property name="title">
@ -294,8 +295,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>545</width> <width>534</width>
<height>178</height> <height>174</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@ -646,6 +647,11 @@
<string>&amp;Preferences</string> <string>&amp;Preferences</string>
</property> </property>
</action> </action>
<action name="actionLSC">
<property name="text">
<string>Least square conformal maps</string>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -12,6 +12,7 @@
#include <CGAL/Parameterization_polyhedron_adaptor_3.h> #include <CGAL/Parameterization_polyhedron_adaptor_3.h>
#include <CGAL/parameterize.h> #include <CGAL/parameterize.h>
#include <CGAL/Discrete_conformal_map_parameterizer_3.h> #include <CGAL/Discrete_conformal_map_parameterizer_3.h>
#include <CGAL/LSCM_parameterizer_3.h>
#include <CGAL/Two_vertices_parameterizer_3.h> #include <CGAL/Two_vertices_parameterizer_3.h>
#include <CGAL/Textured_polyhedron_builder.h> #include <CGAL/Textured_polyhedron_builder.h>
@ -34,7 +35,8 @@ public:
// used by Polyhedron_demo_plugin_helper // used by Polyhedron_demo_plugin_helper
QStringList actionsNames() const { QStringList actionsNames() const {
return QStringList() << "actionMVC" return QStringList() << "actionMVC"
<< "actionDCP"; << "actionDCP"
<< "actionLSC";
} }
bool applicable(QAction*) const { bool applicable(QAction*) const {
@ -44,9 +46,10 @@ public:
public slots: public slots:
void on_actionMVC_triggered(); void on_actionMVC_triggered();
void on_actionDCP_triggered(); void on_actionDCP_triggered();
void on_actionLSC_triggered();
protected: protected:
enum Parameterization_method { PARAM_MVC, PARAM_DCP }; enum Parameterization_method { PARAM_MVC, PARAM_DCP, PARAM_LSC };
void parameterize(Parameterization_method method); void parameterize(Parameterization_method method);
}; // end Polyhedron_demo_parameterization_plugin }; // end Polyhedron_demo_parameterization_plugin
@ -90,6 +93,13 @@ void Polyhedron_demo_parameterization_plugin::parameterize(const Parameterizatio
typedef CGAL::Discrete_conformal_map_parameterizer_3<Adaptor> Parameterizer; typedef CGAL::Discrete_conformal_map_parameterizer_3<Adaptor> Parameterizer;
Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer()); Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
success = err == Parameterizer::OK; success = err == Parameterizer::OK;
}
case PARAM_LSC:
{
std::cout << "Parameterize (LSC)...";
typedef CGAL::LSCM_parameterizer_3<Adaptor> Parameterizer;
Parameterizer::Error_code err = CGAL::parameterize(adaptor,Parameterizer());
success = err == Parameterizer::OK;
} }
} }
@ -145,6 +155,11 @@ void Polyhedron_demo_parameterization_plugin::on_actionDCP_triggered()
parameterize(PARAM_DCP); parameterize(PARAM_DCP);
} }
void Polyhedron_demo_parameterization_plugin::on_actionLSC_triggered()
{
std::cerr << "LSC...";
parameterize(PARAM_LSC);
}
Q_EXPORT_PLUGIN2(Polyhedron_demo_parameterization_plugin, Polyhedron_demo_parameterization_plugin) Q_EXPORT_PLUGIN2(Polyhedron_demo_parameterization_plugin, Polyhedron_demo_parameterization_plugin)
#include "Polyhedron_demo_parameterization_plugin.moc" #include "Polyhedron_demo_parameterization_plugin.moc"