fine tune parameters and fix headers defs

This commit is contained in:
Konstantinos Katrioplas 2018-01-12 14:50:52 +01:00
parent c0e1533cc4
commit c472ac692b
8 changed files with 84 additions and 97 deletions

View File

@ -0,0 +1,40 @@
#ifndef CGAL_POLYGON_MESH_PROCESSING_CONSTRAINTS_MAP_H
#define CGAL_POLYGON_MESH_PROCESSING_CONSTRAINTS_MAP_H
#include <CGAL/property_map.h>
namespace CGAL {
namespace Polygon_mesh_processing {
namespace internal {
template<typename Descriptor>
struct Constrained_vertices_map
{
typedef Descriptor key_type;
typedef bool value_type;
typedef value_type& reference;
typedef boost::read_write_property_map_tag category;
// to change this to boost::shared_ptr
std::shared_ptr<std::set<Descriptor>> const_things;
public:
Constrained_vertices_map() : const_things(new std::set<Descriptor>) {}
friend bool get(const Constrained_vertices_map& map, const key_type& d)
{
typename std::set<Descriptor>::iterator it = map.const_things->find(d);
return it != map.const_things->end() ? true : false;
}
friend void put(Constrained_vertices_map& map, const key_type& d)
{
map.const_things->insert(d);
}
};
}
}
}
#endif //CGAL_POLYGON_MESH_PROCESSING_CONSTRAINTS_MAP_H

View File

@ -18,8 +18,8 @@
//
// Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com)
#ifndef CURVATURE_FLOW_IMPL_H
#define CURVATURE_FLOW_IMPL_H
#ifndef CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_EXPLICIT_IMPL_H
#define CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_EXPLICIT_IMPL_H
#include <utility>
#include <math.h>
@ -37,13 +37,9 @@
namespace CGAL {
namespace Polygon_mesh_processing {
namespace internal {
template<typename PolygonMesh, typename VertexPointMap,
typename CotangentValue = CGAL::internal::Cotangent_value_Meyer<PolygonMesh, VertexPointMap> >
class Cotangent_weight : CotangentValue
@ -317,4 +313,4 @@ private:
#endif // CURVATURE_FLOW_IMPL_H
#endif // CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_EXPLICIT_IMPL_H

View File

@ -18,8 +18,8 @@
//
// Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com)
#ifndef CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_IMPL_H
#define CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_IMPL_H
#ifndef CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_IMPL_H
#define CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_IMPL_H
#include <math.h>
#include <utility>
@ -44,32 +44,6 @@ namespace CGAL {
namespace Polygon_mesh_processing {
namespace internal {
template<typename Descriptor>
struct Constrained_vertices_map
{
typedef Descriptor key_type;
typedef bool value_type;
typedef value_type& reference;
typedef boost::read_write_property_map_tag category;
// to change this to boost::shared_ptr
std::shared_ptr<std::set<Descriptor>> const_things;
public:
Constrained_vertices_map() : const_things(new std::set<Descriptor>) {}
friend bool get(const Constrained_vertices_map& map, const key_type& d)
{
typename std::set<Descriptor>::iterator it = map.const_things->find(d);
return it != map.const_things->end() ? true : false;
}
friend void put(Constrained_vertices_map& map, const key_type& d)
{
map.const_things->insert(d);
}
};
template<typename PolygonMesh, typename VertexPointMap, typename VertexConstraintMap, typename GeomTraits>
class Compatible_remesher
{
@ -106,8 +80,6 @@ public:
{
check_vertex_range(face_range);
//check_constraints();
BOOST_FOREACH(face_descriptor f, face_range)
input_triangles_.push_back(triangle(f));
@ -681,11 +653,11 @@ private:
template<typename FaceRange>
void check_vertex_range(const FaceRange& face_range)
{
BOOST_FOREACH(face_descriptor f, face_range)
{
BOOST_FOREACH(vertex_descriptor v, vertices_around_face(halfedge(f, mesh_), mesh_))
vrange_.insert(v);
}
BOOST_FOREACH(face_descriptor f, face_range)
{
BOOST_FOREACH(vertex_descriptor v, vertices_around_face(halfedge(f, mesh_), mesh_))
vrange_.insert(v);
}
}
private:
@ -710,4 +682,4 @@ private:
#endif // CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_IMPL_H
#endif // CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_IMPL_H

View File

@ -18,8 +18,8 @@
//
// Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com)
#ifndef SMOOTHING_H
#define SMOOTHING_H
#ifndef CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_IMPL_H
#define CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_IMPL_H
#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
@ -118,35 +118,6 @@ struct Incident_area
};
template<typename Descriptor>
struct Constrained_vertices_map
{
typedef Descriptor key_type;
typedef bool value_type;
typedef value_type& reference;
typedef boost::read_write_property_map_tag category;
// to change this to boost::shared_ptr
std::shared_ptr<std::set<Descriptor>> const_things;
public:
Constrained_vertices_map() : const_things(new std::set<Descriptor>) {}
friend bool get(const Constrained_vertices_map& map, const key_type& d)
{
typename std::set<Descriptor>::iterator it = map.const_things->find(d);
return it != map.const_things->end() ? true : false;
}
friend void put(Constrained_vertices_map& map, const key_type& d)
{
map.const_things->insert(d);
}
};
template<typename PolygonMesh,
typename VertexPointMap,
typename VertexConstraintMap,
@ -186,15 +157,14 @@ public:
inc_areas_calculator_(mesh),
nb_vert_(static_cast<int>(vertices(mesh).size())) {}
/*
void init_smoothing()
template<typename FaceRange>
void init_smoothing(const FaceRange& face_range)
{
//check_vertex_range(face_range);
//check_constraints();
check_face_range(face_range);
}
*/
void setup_system(Eigen_matrix& A, Eigen_matrix& L, Eigen_matrix& D,
Eigen_vector& bx, Eigen_vector& by, Eigen_vector& bz,
@ -271,7 +241,8 @@ public:
tripletList.reserve(8 * nb_vert_);
// todo: calculate exactly how many non zero entries there will be.
for(face_descriptor f : faces(mesh_))
//for(face_descriptor f : faces(mesh_))
for(face_descriptor f : frange_)
{
for(halfedge_descriptor hi : halfedges_around_face(halfedge(f, mesh_), mesh_))
{
@ -323,7 +294,7 @@ private:
{
//D.resize(nb_vert_, nb_vert_);
for(face_descriptor f : faces(mesh_))
for(face_descriptor f : frange_)
{
double area = face_area(f, mesh_);
for(vertex_descriptor v : vertices_around_face(halfedge(f, mesh_), mesh_))
@ -546,18 +517,15 @@ private:
}
*/
// to use
template<typename FaceRange>
void check_vertex_range(const FaceRange& face_range)
void check_face_range(const FaceRange& face_range)
{
frange_.resize(faces(mesh_).size());
BOOST_FOREACH(face_descriptor f, face_range)
{
BOOST_FOREACH(vertex_descriptor v, vertices_around_face(halfedge(f, mesh_), mesh_))
vrange.insert(v);
}
frange_.insert(f);
}
private:
// data members
@ -565,7 +533,7 @@ private:
PolygonMesh& mesh_;
VertexPointMap& vpmap_;
std::size_t nb_vert_;
std::set<vertex_descriptor> vrange;
std::set<face_descriptor> frange_;
IndexMap vimap_ = get(boost::vertex_index, mesh_);
VertexConstraintMap vcmap_;
Edge_cotangent_weight<PolygonMesh, VertexPointMap> weight_calculator_;
@ -584,4 +552,4 @@ private:
} // CGAL
#endif // SMOOTHING_H
#endif // CGAL_POLYGON_MESH_PROCESSING_CURVATURE_FLOW_IMPL_H

View File

@ -18,13 +18,14 @@
//
// Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com)
#ifndef CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_H
#define CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_H
#ifndef CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_H
#define CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_H
#include <CGAL/Polygon_mesh_processing/internal/Smoothing/mesh_smoothing_impl.h>
#include <CGAL/Polygon_mesh_processing/internal/Smoothing/evaluation.h>
#include <CGAL/Polygon_mesh_processing/internal/named_function_params.h>
#include <CGAL/Polygon_mesh_processing/internal/named_params_helper.h>
#include <CGAL/Polygon_mesh_processing/internal/Smoothing/constraints_map.h>
#include <CGAL/Polygon_mesh_processing/distance.h>
#ifdef CGAL_PMP_SMOOTHING_VERBOSE
@ -339,4 +340,4 @@ void aspect_ratio_evaluation(PolygonMesh& pmesh, const char* filename)
} // namespace Polygon_mesh_processing
} // namespace CGAL
#endif // CGAL_POLYGON_MESH_PROCESSING_SMOOTHING_H
#endif // CGAL_POLYGON_MESH_PROCESSING_MESH_SMOOTHING_H

View File

@ -18,11 +18,15 @@
//
// Author(s) : Konstantinos Katrioplas (konst.katrioplas@gmail.com)
#ifndef CGAL_POLYGON_MESH_PROCESSING_SHAPE_SMOOTHING_H
#define CGAL_POLYGON_MESH_PROCESSING_sHAPE_SMOOTHING_H
#include <boost/graph/graph_traits.hpp>
#include <boost/property_map/property_map.hpp>
#include <Eigen/Sparse>
#include <CGAL/Polygon_mesh_processing/internal/Smoothing/curvature_flow_impl.h>
#include <CGAL/Polygon_mesh_processing/internal/Smoothing/modified_curvature_flow_impl.h>
#include <CGAL/Polygon_mesh_processing/internal/Smoothing/constraints_map.h>
namespace CGAL {
namespace Polygon_mesh_processing {
@ -242,7 +246,7 @@ void smooth_modified_curvature_flow(const FaceRange& faces, PolygonMesh& pmesh,
}
else
{
// implicit
// implicit scheme
typedef typename Eigen::VectorXd Eigen_vector;
typedef typename Eigen::SparseMatrix<double> Eigen_matrix;
@ -374,3 +378,5 @@ void solve_mcf_system(const FaceRange& faces, PolygonMesh& mesh, const double& t
} //Polygon_mesh_processing
} //CGAL
#endif // CGAL_POLYGON_MESH_PROCESSING_SHAPE_SMOOTHING_H

View File

@ -63,7 +63,11 @@ void test_implicit_constrained(const char* filename)
if(z > 19)
selected_vertices.insert(v);
}
#ifdef CGAL_PMP_SMOOTHING_VERBOSE
std::cout<<"number of selected vertices= "<<selected_vertices.size()<<std::endl;
#endif
Constraints_pmap vcmap(&selected_vertices);
const double time_step = 1;

View File

@ -172,7 +172,7 @@ public Q_SLOTS:
QApplication::setOverrideCursor(Qt::WaitCursor);
unsigned int nb_iter = ui_widget.curvature_iter_spinBox ->value();
smooth_curvature_flow(pmesh, parameters::number_of_iterations(nb_iter));
smooth_curvature_flow_explicit(faces(pmesh), pmesh, parameters::number_of_iterations(nb_iter));
poly_item->invalidateOpenGLBuffers();
poly_item->itemChanged();