mirror of https://github.com/CGAL/cgal
Renaming and cleaning
This commit is contained in:
parent
bbc2bf4e68
commit
bb67aa6d0a
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef CGAL_HOLE_FILLING_FAIR_H
|
#ifndef CGAL_HOLE_FILLING_FAIR_POLYHEDRON_3_H
|
||||||
#define CGAL_HOLE_FILLING_FAIR_H
|
#define CGAL_HOLE_FILLING_FAIR_POLYHEDRON_3_H
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
@ -246,4 +246,4 @@ void fair(Polyhedron& poly,
|
||||||
//}
|
//}
|
||||||
|
|
||||||
}//namespace CGAL
|
}//namespace CGAL
|
||||||
#endif //CGAL_HOLE_FILLING_FAIR_H
|
#endif //CGAL_HOLE_FILLING_FAIR_POLYHEDRON_3_H
|
||||||
|
|
@ -0,0 +1,111 @@
|
||||||
|
#ifndef CGAL_HOLE_FILLING_FILL_HOLE_CONNECTOR
|
||||||
|
#define CGAL_HOLE_FILLING_FILL_HOLE_CONNECTOR
|
||||||
|
#include <CGAL/internal/Fair_Polyhedron_3.h>
|
||||||
|
#include <CGAL/internal/Refine_Polyhedron_3.h>
|
||||||
|
#include <CGAL/internal/Triangulate_hole_Polyhedron_3.h>
|
||||||
|
#include <CGAL/trace.h>
|
||||||
|
|
||||||
|
#include <boost/function_output_iterator.hpp>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <set>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
namespace CGAL {
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
|
struct Nop_functor {
|
||||||
|
template<class T>
|
||||||
|
void operator()(const T& t) const {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Connector class to triangulate - refine - fair holes on Polyhedron_3
|
||||||
|
template<class Polyhedron>
|
||||||
|
class Fill_hole_Polyhedron_3 {
|
||||||
|
|
||||||
|
typedef typename Polyhedron::Traits::Point_3 Point_3;
|
||||||
|
typedef typename Polyhedron::Vertex_handle Vertex_handle;
|
||||||
|
typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
|
||||||
|
typedef typename Polyhedron::Facet_handle Facet_handle;
|
||||||
|
typedef typename Polyhedron::Halfedge_around_facet_circulator Halfedge_around_facet_circulator;
|
||||||
|
typedef typename Polyhedron::Halfedge_around_vertex_circulator Halfedge_around_vertex_circulator;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void average_length(Polyhedron& poly, Vertex_handle vh, std::map<Vertex_handle, double>& scale_attribute)
|
||||||
|
{
|
||||||
|
const Point_3& vp = vh->point();
|
||||||
|
Halfedge_around_vertex_circulator circ(vh->vertex_begin()), done(circ);
|
||||||
|
int deg = 0;
|
||||||
|
double sum = 0;
|
||||||
|
do {
|
||||||
|
const Point_3& vq = circ->opposite()->vertex()->point();
|
||||||
|
sum += std::sqrt(CGAL::squared_distance(vp, vq));
|
||||||
|
++deg;
|
||||||
|
++circ;
|
||||||
|
} while(circ != done);
|
||||||
|
scale_attribute[vh] = sum/deg;
|
||||||
|
}
|
||||||
|
|
||||||
|
void get_boundary_vertices(Polyhedron& poly, Halfedge_handle it, std::set<Vertex_handle>& boundary_vertices) {
|
||||||
|
Halfedge_around_facet_circulator circ(it), done(circ);
|
||||||
|
do{
|
||||||
|
boundary_vertices.insert(circ->vertex());
|
||||||
|
} while (++circ != done);
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
template<class OutputIterator>
|
||||||
|
void triangulate_and_refine_hole(Polyhedron& poly, Halfedge_handle it, double alpha, OutputIterator output)
|
||||||
|
{
|
||||||
|
if(! it->is_border()){ return; }
|
||||||
|
|
||||||
|
// compute scale_attribute before triangulation
|
||||||
|
std::map<Vertex_handle, double> scale_attribute;
|
||||||
|
Halfedge_around_facet_circulator circ(it), done(circ);
|
||||||
|
do{
|
||||||
|
average_length(poly, circ->vertex(), scale_attribute);
|
||||||
|
} while (++circ != done);
|
||||||
|
// Triangulate
|
||||||
|
std::set<Facet_handle> facets;
|
||||||
|
triangulate_hole(poly, it, std::inserter(facets, facets.begin()));
|
||||||
|
// Refine
|
||||||
|
internal::Refine_Polyhedron_3<Polyhedron> refine_functor(alpha);
|
||||||
|
refine_functor(poly, scale_attribute, facets);
|
||||||
|
|
||||||
|
std::copy(facets.begin(), facets.end(), output);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class SparseLinearSolver, class WeightCalculator>
|
||||||
|
void triangulate_refine_and_fair
|
||||||
|
(Polyhedron& poly, Halfedge_handle it, double alpha, WeightCalculator weight_calculator)
|
||||||
|
{
|
||||||
|
if(! it->is_border()){ return; }
|
||||||
|
|
||||||
|
// save boundary vertices before triangulation
|
||||||
|
std::set<Vertex_handle> boundary_vertices;
|
||||||
|
get_boundary_vertices(poly, it, boundary_vertices);
|
||||||
|
|
||||||
|
//Triangulate and refine
|
||||||
|
std::vector<Facet_handle> facets;
|
||||||
|
triangulate_and_refine_hole(poly, it, alpha, std::back_inserter(facets));
|
||||||
|
|
||||||
|
// get interior vertices
|
||||||
|
std::set<Vertex_handle> interior_vertices;
|
||||||
|
for(std::vector<Facet_handle>::iterator it = facets.begin(); it != facets.end(); ++it) {
|
||||||
|
Halfedge_around_facet_circulator circ = (*it)->facet_begin();
|
||||||
|
do {
|
||||||
|
if(boundary_vertices.find(circ->vertex()) == boundary_vertices.end()) {
|
||||||
|
interior_vertices.insert(circ->vertex());
|
||||||
|
}
|
||||||
|
} while(++circ != (*it)->facet_begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
CGAL_TRACE_STREAM << "before fair |boundary vertices| = " << boundary_vertices.size() << std::endl;
|
||||||
|
CGAL_TRACE_STREAM << "before fair |interior vertices| = " << interior_vertices.size() << std::endl;
|
||||||
|
// Fair
|
||||||
|
fair<SparseLinearSolver>(poly, interior_vertices, weight_calculator);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}//namespace internal
|
||||||
|
}//namespace CGAL
|
||||||
|
#endif // CGAL_HOLE_FILLING_FILL_HOLE_CONNECTOR
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef CGAL_HOLE_FILLING_REFINE_H
|
#ifndef CGAL_HOLE_FILLING_REFINE_POLYHEDRON_3_H
|
||||||
#define CGAL_HOLE_FILLING_REFINE_H
|
#define CGAL_HOLE_FILLING_REFINE_POLYHEDRON_3_H
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
@ -148,4 +148,4 @@ public:
|
||||||
|
|
||||||
}//namespace internal
|
}//namespace internal
|
||||||
}//namespace CGAL
|
}//namespace CGAL
|
||||||
#endif //CGAL_HOLE_FILLING_REFINE_H
|
#endif //CGAL_HOLE_FILLING_REFINE_POLYHEDRON_3_H
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
#ifndef CGAL_HOLE_FILLING_SMOOTH_H
|
#ifndef CGAL_HOLE_FILLING_SMOOTH_POLYHEDRON_3_H
|
||||||
#define CGAL_HOLE_FILLING_SMOOTH_H
|
#define CGAL_HOLE_FILLING_SMOOTH_POLYHEDRON_3_H
|
||||||
// going to be moved some place more relevant
|
// going to be moved some place more relevant
|
||||||
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
#include <CGAL/boost/graph/graph_traits_Polyhedron_3.h>
|
||||||
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
|
#include <CGAL/boost/graph/properties_Polyhedron_3.h>
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
|
||||||
// simple laplacian smoothing
|
// simple Laplacian smoothing
|
||||||
template<class WeightCalculator, class Polyhedron, class InputIterator>
|
template<class WeightCalculator, class Polyhedron, class InputIterator>
|
||||||
void smooth( Polyhedron& polyhedron,
|
void smooth( Polyhedron& polyhedron,
|
||||||
InputIterator vertex_begin,
|
InputIterator vertex_begin,
|
||||||
|
|
@ -17,8 +17,6 @@ void smooth( Polyhedron& polyhedron,
|
||||||
WeightCalculator weight_calculator = WeightCalculator()
|
WeightCalculator weight_calculator = WeightCalculator()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
typedef typename boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
|
|
||||||
typedef typename boost::graph_traits<Polyhedron>::edge_descriptor edge_descriptor;
|
|
||||||
typedef typename boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
|
typedef typename boost::graph_traits<Polyhedron>::vertex_descriptor vertex_descriptor;
|
||||||
typedef typename boost::graph_traits<Polyhedron>::in_edge_iterator in_edge_iterator;
|
typedef typename boost::graph_traits<Polyhedron>::in_edge_iterator in_edge_iterator;
|
||||||
typedef typename Polyhedron::Traits::Point_3 Point;
|
typedef typename Polyhedron::Traits::Point_3 Point;
|
||||||
|
|
@ -1,17 +1,19 @@
|
||||||
#ifndef CGAL_HOLE_FILLING_TRIANGULATE_H
|
#ifndef CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H
|
||||||
#define CGAL_HOLE_FILLING_TRIANGULATE_H
|
#define CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <CGAL/assertions.h>
|
#include <CGAL/assertions.h>
|
||||||
|
#include <CGAL/Mesh_3/dihedral_angle_3.h>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template<class Polyhedron>
|
template<class Polyhedron>
|
||||||
class Triangulate_Hole_Polyhedron_3{
|
class Triangulate_hole_Polyhedron_3{
|
||||||
// typedefs
|
// typedefs
|
||||||
typedef typename Polyhedron::Traits::Point_3 Point_3;
|
typedef typename Polyhedron::Traits::Point_3 Point_3;
|
||||||
typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
|
typedef typename Polyhedron::Halfedge_handle Halfedge_handle;
|
||||||
|
|
@ -196,9 +198,8 @@ public:
|
||||||
void operator()(Polyhedron& poly, Halfedge_handle it) {
|
void operator()(Polyhedron& poly, Halfedge_handle it) {
|
||||||
triangulate(poly, it, dummy_inserter());
|
triangulate(poly, it, dummy_inserter());
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}//namespace internal
|
}//namespace internal
|
||||||
}//namespace CGAL
|
}//namespace CGAL
|
||||||
#endif //CGAL_HOLE_FILLING_TRIANGULATE_H
|
#endif //CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
|
#ifndef CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
|
||||||
#ifndef CGAL_FILL_HOLE_H
|
#define CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
|
||||||
#define CGAL_FILL_HOLE_H
|
|
||||||
|
|
||||||
#include <CGAL/Mesh_3/dihedral_angle_3.h>
|
#include <CGAL/Mesh_3/dihedral_angle_3.h>
|
||||||
#include <CGAL/utility.h>
|
#include <CGAL/utility.h>
|
||||||
|
|
@ -8,9 +7,10 @@
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace CGAL {
|
namespace CGAL {
|
||||||
|
namespace internal {
|
||||||
|
|
||||||
template <typename K>
|
template <typename K>
|
||||||
class Fill_hole {
|
class Triangulate_hole_polyline {
|
||||||
public:
|
public:
|
||||||
typedef typename K::Point_3 Point_3;
|
typedef typename K::Point_3 Point_3;
|
||||||
typedef std::vector<Point_3> Polyline_3;
|
typedef std::vector<Point_3> Polyline_3;
|
||||||
|
|
@ -156,6 +156,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
} // namespace internal
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Creates triangles to fill the hole defined by points in the range `(pbegin,pend)`.
|
Creates triangles to fill the hole defined by points in the range `(pbegin,pend)`.
|
||||||
|
|
@ -170,7 +171,7 @@ fill_hole(InputIterator pbegin, InputIterator pend,
|
||||||
OutputIterator out)
|
OutputIterator out)
|
||||||
{
|
{
|
||||||
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<InputIterator>::value_type>::Kernel Kernel;
|
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<InputIterator>::value_type>::Kernel Kernel;
|
||||||
typedef Fill_hole<Kernel> Fill;
|
typedef CGAL::internal::Triangulate_hole_polyline<Kernel> Fill;
|
||||||
typename Fill::Polyline_3 P(pbegin, pend);
|
typename Fill::Polyline_3 P(pbegin, pend);
|
||||||
typename Fill::Polyline_3 Q(qbegin, qend);
|
typename Fill::Polyline_3 Q(qbegin, qend);
|
||||||
if(P.front() != P.back()){
|
if(P.front() != P.back()){
|
||||||
|
|
@ -193,7 +194,7 @@ fill_hole(InputIterator pbegin, InputIterator pend,
|
||||||
OutputIterator out)
|
OutputIterator out)
|
||||||
{
|
{
|
||||||
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<InputIterator>::value_type>::Kernel Kernel;
|
typedef typename CGAL::Kernel_traits< typename std::iterator_traits<InputIterator>::value_type>::Kernel Kernel;
|
||||||
typedef Fill_hole<Kernel> Fill;
|
typedef CGAL::internal::Triangulate_hole_polyline<Kernel> Fill;
|
||||||
typename Fill::Polyline_3 P(pbegin, pend);
|
typename Fill::Polyline_3 P(pbegin, pend);
|
||||||
typename Fill::Polyline_3 Q;
|
typename Fill::Polyline_3 Q;
|
||||||
if(P.front() != P.back()){
|
if(P.front() != P.back()){
|
||||||
|
|
@ -205,4 +206,4 @@ fill_hole(InputIterator pbegin, InputIterator pend,
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_FILL_HOLE_H
|
#endif // CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYLINE_H
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
#include "ui_Hole_filling_widget.h"
|
#include "ui_Hole_filling_widget.h"
|
||||||
#include "Polyhedron_type.h"
|
#include "Polyhedron_type.h"
|
||||||
|
|
||||||
//#include <CGAL/Fill_hole.h>
|
|
||||||
#include <CGAL/Fill_hole_Polyhedron_3.h>
|
#include <CGAL/Fill_hole_Polyhedron_3.h>
|
||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,8 @@
|
||||||
#include "ui_Smoothing_fairing_widget.h"
|
#include "ui_Smoothing_fairing_widget.h"
|
||||||
#include "Polyhedron_type.h"
|
#include "Polyhedron_type.h"
|
||||||
|
|
||||||
//#include <CGAL/Fill_hole.h>
|
|
||||||
#include <CGAL/Fill_hole_Polyhedron_3.h>
|
#include <CGAL/Fill_hole_Polyhedron_3.h>
|
||||||
#include <CGAL/internal/Smooth.h>
|
#include <CGAL/internal/Smooth_Polyhedron_3.h>
|
||||||
|
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue