Merge branch 'Surface_mesh_parametrisation-OpenNL_Eigen-GF-old' into Surface_mesh_parametrisation-OpenNL_Eigen-GF

This commit is contained in:
Simon Giraudot 2015-08-06 12:07:42 +02:00
commit 6196c183c7
3 changed files with 33 additions and 9 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">
@ -95,6 +95,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">
@ -652,6 +653,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>
@ -35,7 +36,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 {
@ -45,9 +47,10 @@ public:
public Q_SLOTS: public Q_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
@ -91,6 +94,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;
} }
} }
@ -146,4 +156,10 @@ 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);
}
#include "Polyhedron_demo_parameterization_plugin.moc" #include "Polyhedron_demo_parameterization_plugin.moc"

View File

@ -3,7 +3,7 @@
#include <CGAL/IO/Polyhedron_iostream.h> #include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Parameterization_polyhedron_adaptor_3.h> #include <CGAL/Parameterization_polyhedron_adaptor_3.h>
#include <CGAL/parameterize.h> #include <CGAL/parameterize.h>
#include <CGAL/Timer.h>
#include <CGAL/Eigen_solver_traits.h> #include <CGAL/Eigen_solver_traits.h>
#include <iostream> #include <iostream>
@ -17,7 +17,7 @@
typedef CGAL::Simple_cartesian<double> Kernel; typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron; typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Timer Timer;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// main() // main()
@ -65,7 +65,8 @@ int main(int argc, char * argv[])
typedef CGAL::Parameterization_polyhedron_adaptor_3<Polyhedron> typedef CGAL::Parameterization_polyhedron_adaptor_3<Polyhedron>
Parameterization_polyhedron_adaptor; Parameterization_polyhedron_adaptor;
Timer t;
t.start();
Parameterization_polyhedron_adaptor mesh_adaptor(mesh); Parameterization_polyhedron_adaptor mesh_adaptor(mesh);
//*************************************** //***************************************
@ -77,16 +78,17 @@ int main(int argc, char * argv[])
typedef CGAL::Circular_border_arc_length_parameterizer_3<Parameterization_polyhedron_adaptor> typedef CGAL::Circular_border_arc_length_parameterizer_3<Parameterization_polyhedron_adaptor>
Border_parameterizer; Border_parameterizer;
// Eigen solver // Eigen solver
typedef CGAL::Eigen_solver_traits<> Solver; typedef CGAL::Eigen_solver_traits<Eigen::BiCGSTAB<CGAL::Eigen_sparse_matrix<double>::EigenType, Eigen::IncompleteLUT< double > > > Solver;
// Floater Mean Value Coordinates parameterization // Floater Mean Value Coordinates parameterization
// (circular border) with Eigen solver // (circular border) with Eigen solver
typedef CGAL::Mean_value_coordinates_parameterizer_3<Parameterization_polyhedron_adaptor, typedef CGAL::Mean_value_coordinates_parameterizer_3<Parameterization_polyhedron_adaptor,
Border_parameterizer, Border_parameterizer,
Solver> Solver>
Parameterizer; Parameterizer;
Parameterizer::Error_code err = CGAL::parameterize(mesh_adaptor, Parameterizer()); Parameterizer::Error_code err = CGAL::parameterize(mesh_adaptor, Parameterizer());
t.stop();
switch(err) { switch(err) {
case Parameterizer::OK: // Success case Parameterizer::OK: // Success
@ -119,6 +121,6 @@ int main(int argc, char * argv[])
double v = mesh_adaptor.info(pVertex->halfedge())->uv().y(); double v = mesh_adaptor.info(pVertex->halfedge())->uv().y();
std::cout << "(u,v) = (" << u << "," << v << ")" << std::endl; std::cout << "(u,v) = (" << u << "," << v << ")" << std::endl;
} }
std::cerr << t.time() << "sec." << std::endl;
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }