mirror of https://github.com/CGAL/cgal
move fair() and refine() to their own files
- move fairing and refinement internal code to the subfolder Meshing_functions (they were in Hole_filling) - and fix namespaces
This commit is contained in:
parent
e4bbbe518b
commit
27d329b1e9
|
|
@ -48,8 +48,8 @@
|
|||
- `CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh()`
|
||||
|
||||
## Meshing Functions ##
|
||||
- `CGAL::fair()`
|
||||
- `CGAL::refine()`
|
||||
- `CGAL::Polygon_mesh_processing::fair()`
|
||||
- `CGAL::Polygon_mesh_processing::refine()`
|
||||
- `CGAL::Polygon_mesh_processing::triangulate_faces()`
|
||||
|
||||
## Normal Computation Functions ##
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
|
||||
#include <CGAL/internal/Meshing_functions/Fair_Polyhedron_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Polygon_mesh_processing {
|
||||
|
||||
/*!
|
||||
\ingroup PkgPolygonMeshProcessing
|
||||
@brief Function fairing a region on polygon mesh.
|
||||
The region denoted by @a vertex_begin and @a vertex_end might contain multiple disconnected components.
|
||||
Note that the structure is not altered in any way, only positions of the vertices get updated.
|
||||
|
||||
Fairing might fail if fixed vertices, which are used as boundary conditions, do not suffice to solve constructed linear system.
|
||||
The larger @a continuity gets, the more fixed vertices are required.
|
||||
|
||||
@tparam SparseLinearSolver a model of `SparseLinearAlgebraTraitsWithPreFactor_d`. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
|
||||
and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter.
|
||||
@tparam WeightCalculator a model of `FairWeightCalculator` and can be omitted to use default Cotangent weights
|
||||
@tparam PolygonMesh must be a model of `MutableFaceGraph`
|
||||
@tparam InputIterator iterator over input vertices
|
||||
|
||||
@param pmesh polygon mesh to be faired
|
||||
@param vertex_begin first iterator of the range of vertices
|
||||
@param vertex_end past-the-end iterator of the range of vertices
|
||||
@param weight_calculator function object to calculate weights, default to Cotangent weights and can be omitted
|
||||
@param continuity tangential continuity, default to `FAIRING_C_1` and can be omitted
|
||||
|
||||
@return `true` if fairing is successful, otherwise no vertex position is changed
|
||||
|
||||
@todo accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not.
|
||||
\todo WeightCalculator should be a property map
|
||||
*/
|
||||
template<class SparseLinearSolver, class WeightCalculator, class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vertex_begin,
|
||||
InputIterator vertex_end,
|
||||
WeightCalculator weight_calculator,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
internal::Fair_Polyhedron_3<PolygonMesh, SparseLinearSolver, WeightCalculator> fair_functor(pmesh, weight_calculator);
|
||||
return fair_functor.fair(vertex_begin, vertex_end, continuity);
|
||||
}
|
||||
|
||||
//use default SparseLinearSolver
|
||||
template<class WeightCalculator, class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vb,
|
||||
InputIterator ve,
|
||||
WeightCalculator weight_calculator,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver;
|
||||
return fair<Sparse_linear_solver, WeightCalculator, PolygonMesh, InputIterator>
|
||||
(pmesh, vb, ve, weight_calculator, continuity);
|
||||
}
|
||||
|
||||
//use default WeightCalculator
|
||||
template<class SparseLinearSolver, class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vb,
|
||||
InputIterator ve,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
typedef internal::Cotangent_weight_with_voronoi_area_fairing<PolygonMesh> Weight_calculator;
|
||||
return fair<SparseLinearSolver, Weight_calculator, PolygonMesh, InputIterator>
|
||||
(pmesh, vb, ve, Weight_calculator(), continuity);
|
||||
}
|
||||
|
||||
//use default SparseLinearSolver and WeightCalculator
|
||||
template<class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vb,
|
||||
InputIterator ve,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver;
|
||||
return fair<Sparse_linear_solver, PolygonMesh, InputIterator>(pmesh, vb, ve, continuity);
|
||||
}
|
||||
|
||||
} //end namespace Polygon_mesh_processing
|
||||
|
||||
} //end namespace CGAL
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
|
||||
#include <CGAL/internal/Meshing_functions/Refine_Polyhedron_3.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Polygon_mesh_processing {
|
||||
|
||||
/*!
|
||||
\ingroup PkgPolygonMeshProcessing
|
||||
@brief Function refining a region on polygon mesh
|
||||
|
||||
@tparam Polyhedron must be a model of `MutableFaceGraph`
|
||||
@tparam InputIterator iterator over input facets
|
||||
@tparam FacetOutputIterator iterator holding `boost::graph_traits<PolygonMesh>::face_descriptor` for patch facets
|
||||
@tparam VertexOutputIterator iterator holding `boost::graph_traits<PolygonMesh>::vertex_descriptor` for patch vertices
|
||||
|
||||
@param pmesh mesh to be refined
|
||||
@param facet_begin first iterator of the range of facets
|
||||
@param facet_end past-the-end iterator of the range of facets
|
||||
@param facet_out iterator over newly created facets
|
||||
@param vertex_out iterator over newly created vertices
|
||||
@param density_control_factor factor for density where larger values cause denser refinements
|
||||
|
||||
@return pair of @a facet_out and @a vertex_out
|
||||
|
||||
@todo current algorithm iterates 10 times at most, since (I guess) there is no termination proof.
|
||||
*/
|
||||
template<class PolygonMesh,
|
||||
class InputIterator,
|
||||
class FacetOutputIterator,
|
||||
class VertexOutputIterator>
|
||||
std::pair<FacetOutputIterator, VertexOutputIterator>
|
||||
refine(PolygonMesh& pmesh,
|
||||
InputIterator facet_begin,
|
||||
InputIterator facet_end,
|
||||
FacetOutputIterator facet_out,
|
||||
VertexOutputIterator vertex_out,
|
||||
double density_control_factor = std::sqrt(2.0))
|
||||
{
|
||||
internal::Refine_Polyhedron_3<PolygonMesh> refine_functor(pmesh);
|
||||
refine_functor.refine(facet_begin,
|
||||
facet_end,
|
||||
facet_out,
|
||||
vertex_out,
|
||||
density_control_factor);
|
||||
return std::make_pair(facet_out, vertex_out);
|
||||
}
|
||||
|
||||
}//end namespace Polygon_mesh_processing
|
||||
|
||||
}//end namespace CGAL
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
#include <vector>
|
||||
|
||||
namespace CGAL {
|
||||
namespace Polygon_mesh_processing {
|
||||
namespace internal {
|
||||
|
||||
|
||||
|
|
@ -71,7 +72,7 @@ struct Tracer_polyhedron
|
|||
|
||||
// This function is used in test cases (since it returns not just OutputIterator but also Weight)
|
||||
template<class PolygonMesh, class OutputIterator>
|
||||
std::pair<OutputIterator, Weight_min_max_dihedral_and_area>
|
||||
std::pair<OutputIterator, CGAL::internal::Weight_min_max_dihedral_and_area>
|
||||
triangulate_hole_Polyhedron(PolygonMesh& pmesh,
|
||||
typename boost::graph_traits<PolygonMesh>::halfedge_descriptor border_halfedge,
|
||||
OutputIterator out,
|
||||
|
|
@ -98,7 +99,8 @@ triangulate_hole_Polyhedron(PolygonMesh& pmesh,
|
|||
P_edges.push_back(*circ);
|
||||
if(!vertex_set.insert(std::make_pair(target(*circ,pmesh), n++)).second) {
|
||||
CGAL_warning(!"Returning no output. Non-manifold vertex is found on boundary!");
|
||||
return std::make_pair(out, Weight_min_max_dihedral_and_area::NOT_VALID());
|
||||
return std::make_pair(out,
|
||||
CGAL::internal::Weight_min_max_dihedral_and_area::NOT_VALID());
|
||||
}
|
||||
} while (++circ != done);
|
||||
|
||||
|
|
@ -129,18 +131,20 @@ triangulate_hole_Polyhedron(PolygonMesh& pmesh,
|
|||
|
||||
//#define CGAL_USE_WEIGHT_INCOMPLETE
|
||||
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
|
||||
typedef Weight_calculator<Weight_incomplete<Weight_min_max_dihedral_and_area>, Is_valid_existing_edges_and_degenerate_triangle> WC;
|
||||
typedef CGAL::internal::Weight_calculator<Weight_incomplete<CGAL::internal::Weight_min_max_dihedral_and_area>,
|
||||
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle> WC;
|
||||
#else
|
||||
typedef Weight_calculator<Weight_min_max_dihedral_and_area, Is_valid_existing_edges_and_degenerate_triangle> WC;
|
||||
typedef CGAL::internal::Weight_calculator<CGAL::internal::Weight_min_max_dihedral_and_area,
|
||||
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle> WC;
|
||||
#endif
|
||||
|
||||
Is_valid_existing_edges_and_degenerate_triangle iv(existing_edges);
|
||||
CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle iv(existing_edges);
|
||||
|
||||
// fill hole using polyline function, with custom tracer for PolygonMesh
|
||||
Tracer_polyhedron<PolygonMesh, OutputIterator>
|
||||
tracer(out, pmesh, P_edges);
|
||||
Weight_min_max_dihedral_and_area weight =
|
||||
internal::triangulate_hole_polyline(P, Q,
|
||||
CGAL::internal::Weight_min_max_dihedral_and_area weight =
|
||||
triangulate_hole_polyline(P, Q,
|
||||
tracer, WC(iv), use_delaunay_triangulation)
|
||||
#ifdef CGAL_USE_WEIGHT_INCOMPLETE
|
||||
.weight; // get actual weight in Weight_incomplete
|
||||
|
|
@ -153,6 +157,6 @@ triangulate_hole_Polyhedron(PolygonMesh& pmesh,
|
|||
}
|
||||
|
||||
}// namespace internal
|
||||
|
||||
}//namespace CGAL
|
||||
}// namespace Polygon_mesh_processing
|
||||
}// namespace CGAL
|
||||
#endif //CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#endif
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/*!
|
||||
\ingroup PkgPolygonMeshProcessing
|
||||
@brief Fairing continuity type
|
||||
|
|
@ -25,6 +26,8 @@ enum Fairing_continuity
|
|||
FAIRING_C_2 = 2 /**< C2 continuity */
|
||||
};
|
||||
|
||||
namespace Polygon_mesh_processing {
|
||||
|
||||
namespace internal {
|
||||
|
||||
struct Fair_default_sparse_linear_solver {
|
||||
|
|
@ -193,83 +196,7 @@ public:
|
|||
|
||||
}//namespace internal
|
||||
|
||||
/*!
|
||||
\ingroup PkgPolygonMeshProcessing
|
||||
@brief Function fairing a region on polygon mesh.
|
||||
The region denoted by @a vertex_begin and @a vertex_end might contain multiple disconnected components.
|
||||
Note that the structure is not altered in any way, only positions of the vertices get updated.
|
||||
|
||||
Fairing might fail if fixed vertices, which are used as boundary conditions, do not suffice to solve constructed linear system.
|
||||
The larger @a continuity gets, the more fixed vertices are required.
|
||||
|
||||
@tparam SparseLinearSolver a model of `SparseLinearAlgebraTraitsWithPreFactor_d`. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available
|
||||
and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter.
|
||||
@tparam WeightCalculator a model of `FairWeightCalculator` and can be omitted to use default Cotangent weights
|
||||
@tparam PolygonMesh must be a model of `MutableFaceGraph`
|
||||
@tparam InputIterator iterator over input vertices
|
||||
|
||||
@param pmesh polygon mesh to be faired
|
||||
@param vertex_begin first iterator of the range of vertices
|
||||
@param vertex_end past-the-end iterator of the range of vertices
|
||||
@param weight_calculator function object to calculate weights, default to Cotangent weights and can be omitted
|
||||
@param continuity tangential continuity, default to `FAIRING_C_1` and can be omitted
|
||||
|
||||
@return `true` if fairing is successful, otherwise no vertex position is changed
|
||||
|
||||
@todo accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not.
|
||||
\todo move to a non-internal header file
|
||||
\todo WeightCalculator should be a property map
|
||||
*/
|
||||
template<class SparseLinearSolver, class WeightCalculator, class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vertex_begin,
|
||||
InputIterator vertex_end,
|
||||
WeightCalculator weight_calculator,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
internal::Fair_Polyhedron_3<PolygonMesh, SparseLinearSolver, WeightCalculator> fair_functor(pmesh, weight_calculator);
|
||||
return fair_functor.fair(vertex_begin, vertex_end, continuity);
|
||||
}
|
||||
|
||||
//use default SparseLinearSolver
|
||||
template<class WeightCalculator, class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vb,
|
||||
InputIterator ve,
|
||||
WeightCalculator weight_calculator,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver;
|
||||
return fair<Sparse_linear_solver, WeightCalculator, PolygonMesh, InputIterator>
|
||||
(pmesh, vb, ve, weight_calculator, continuity);
|
||||
}
|
||||
|
||||
//use default WeightCalculator
|
||||
template<class SparseLinearSolver, class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vb,
|
||||
InputIterator ve,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
typedef internal::Cotangent_weight_with_voronoi_area_fairing<PolygonMesh> Weight_calculator;
|
||||
return fair<SparseLinearSolver, Weight_calculator, PolygonMesh, InputIterator>
|
||||
(pmesh, vb, ve, Weight_calculator(), continuity);
|
||||
}
|
||||
|
||||
//use default SparseLinearSolver and WeightCalculator
|
||||
template<class PolygonMesh, class InputIterator>
|
||||
bool fair(PolygonMesh& pmesh,
|
||||
InputIterator vb,
|
||||
InputIterator ve,
|
||||
Fairing_continuity continuity = FAIRING_C_1
|
||||
)
|
||||
{
|
||||
typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver;
|
||||
return fair<Sparse_linear_solver, PolygonMesh, InputIterator>(pmesh, vb, ve, continuity);
|
||||
}
|
||||
}//namespace Polygon_mesh_processing
|
||||
|
||||
}//namespace CGAL
|
||||
#endif //CGAL_HOLE_FILLING_FAIR_POLYHEDRON_3_H
|
||||
|
|
@ -12,6 +12,9 @@
|
|||
#include <CGAL/boost/graph/Euler_operations.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Polygon_mesh_processing {
|
||||
|
||||
namespace internal {
|
||||
|
||||
template<class PolygonMesh>
|
||||
|
|
@ -272,47 +275,7 @@ public:
|
|||
|
||||
}//namespace internal
|
||||
|
||||
/*!
|
||||
\ingroup PkgPolygonMeshProcessing
|
||||
@brief Function refining a region on polygon mesh
|
||||
|
||||
@tparam Polyhedron must be a model of `MutableFaceGraph`
|
||||
@tparam InputIterator iterator over input facets
|
||||
@tparam FacetOutputIterator iterator holding `boost::graph_traits<PolygonMesh>::face_descriptor` for patch facets
|
||||
@tparam VertexOutputIterator iterator holding `boost::graph_traits<PolygonMesh>::vertex_descriptor` for patch vertices
|
||||
|
||||
@param pmesh mesh to be refined
|
||||
@param facet_begin first iterator of the range of facets
|
||||
@param facet_end past-the-end iterator of the range of facets
|
||||
@param facet_out iterator over newly created facets
|
||||
@param vertex_out iterator over newly created vertices
|
||||
@param density_control_factor factor for density where larger values cause denser refinements
|
||||
|
||||
@return pair of @a facet_out and @a vertex_out
|
||||
|
||||
@todo current algorithm iterates 10 times at most, since (I guess) there is no termination proof.
|
||||
\todo move to a non-internal header file
|
||||
|
||||
*/
|
||||
template<
|
||||
class PolygonMesh,
|
||||
class InputIterator,
|
||||
class FacetOutputIterator,
|
||||
class VertexOutputIterator
|
||||
>
|
||||
std::pair<FacetOutputIterator, VertexOutputIterator>
|
||||
refine(PolygonMesh& pmesh,
|
||||
InputIterator facet_begin,
|
||||
InputIterator facet_end,
|
||||
FacetOutputIterator facet_out,
|
||||
VertexOutputIterator vertex_out,
|
||||
double density_control_factor = std::sqrt(2.0))
|
||||
{
|
||||
internal::Refine_Polyhedron_3<PolygonMesh> refine_functor(pmesh);
|
||||
refine_functor.refine
|
||||
(facet_begin, facet_end, facet_out, vertex_out, density_control_factor);
|
||||
return std::make_pair(facet_out, vertex_out);
|
||||
}
|
||||
}//namespace Polygon_mesh_processing
|
||||
|
||||
}//namespace CGAL
|
||||
#endif //CGAL_HOLE_FILLING_REFINE_POLYHEDRON_3_H
|
||||
|
|
@ -231,7 +231,7 @@ self_intersections(const PolygonMesh& pmesh,
|
|||
box_ptr.push_back(&*b);
|
||||
|
||||
// compute self-intersections filtered out by boxes
|
||||
internal::Intersect_facets<PolygonMesh,GeomTraits,Box,OutputIterator> intersect_facets(pmesh, out, geom_traits);
|
||||
CGAL::internal::Intersect_facets<PolygonMesh,GeomTraits,Box,OutputIterator> intersect_facets(pmesh, out, geom_traits);
|
||||
std::ptrdiff_t cutoff = 2000;
|
||||
CGAL::box_self_intersection_d(box_ptr.begin(), box_ptr.end(),intersect_facets,cutoff);
|
||||
return intersect_facets.m_iterator;
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
#define CGAL_TRIANGULATE_HOLE_H
|
||||
|
||||
#include <CGAL/internal/Hole_filling/Triangulate_hole_Polyhedron_3.h>
|
||||
#include <CGAL/internal/Hole_filling/Refine_Polyhedron_3.h>
|
||||
#include <CGAL/internal/Hole_filling/Fair_Polyhedron_3.h>
|
||||
#include <CGAL/internal/Hole_filling/Triangulate_hole_polyline.h>
|
||||
#include <CGAL/Polygon_mesh_processing/refine.h>
|
||||
#include <CGAL/Polygon_mesh_processing/fair.h>
|
||||
#include <CGAL/Default.h>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
|
|
@ -149,7 +149,7 @@ namespace Polygon_mesh_processing {
|
|||
(pmesh, border_halfedge, face_out, std::back_inserter(patch),
|
||||
density_control_factor, use_delaunay_triangulation).first;
|
||||
|
||||
typedef CGAL::internal::Fair_default_sparse_linear_solver::Solver Default_solver;
|
||||
typedef internal::Fair_default_sparse_linear_solver::Solver Default_solver;
|
||||
typedef typename Default::Get<SparseLinearSolver, Default_solver>::type Solver;
|
||||
|
||||
bool fair_success = fair<Solver>(pmesh, patch.begin(), patch.end(), weight_calculator, continuity);
|
||||
|
|
@ -212,8 +212,9 @@ namespace Polygon_mesh_processing {
|
|||
bool use_delaunay_triangulation = false)
|
||||
{
|
||||
typedef typename std::iterator_traits<InputIterator>::value_type Point_3;
|
||||
typedef internal::Weight_min_max_dihedral_and_area Weight;
|
||||
typedef internal::Weight_calculator<Weight, internal::Is_valid_degenerate_triangle> WC;
|
||||
typedef CGAL::internal::Weight_min_max_dihedral_and_area Weight;
|
||||
typedef CGAL::internal::Weight_calculator<Weight,
|
||||
CGAL::internal::Is_valid_degenerate_triangle> WC;
|
||||
typedef std::vector<std::pair<int, int> > Holes;
|
||||
typedef std::back_insert_iterator<Holes> Holes_out;
|
||||
|
||||
|
|
@ -221,9 +222,9 @@ namespace Polygon_mesh_processing {
|
|||
std::vector<Point_3> Q(qbegin, qend);
|
||||
Holes holes;//just to check there is no holes
|
||||
|
||||
internal::Tracer_polyline_incomplete<OutputIteratorValueType, OutputIterator, Holes_out>
|
||||
CGAL::internal::Tracer_polyline_incomplete<OutputIteratorValueType, OutputIterator, Holes_out>
|
||||
tracer(out, Holes_out(holes));
|
||||
internal::triangulate_hole_polyline(P, Q, tracer, WC(), use_delaunay_triangulation);
|
||||
triangulate_hole_polyline(P, Q, tracer, WC(), use_delaunay_triangulation);
|
||||
CGAL_assertion(holes.empty());
|
||||
return tracer.out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,8 @@ void test_triangulate_hole_weight(const char* file_name, bool use_DT) {
|
|||
|
||||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
|
||||
std::vector<Facet_handle> patch;
|
||||
Weight w_algo = CGAL::internal::triangulate_hole_Polyhedron(poly, *it, back_inserter(patch), use_DT).second;
|
||||
Weight w_algo = CGAL::Polygon_mesh_processing::internal::triangulate_hole_Polyhedron(poly,
|
||||
*it, back_inserter(patch), use_DT).second;
|
||||
if(patch.empty()) { continue; }
|
||||
Weight w_test = calculate_weight_for_patch(poly, patch.begin(), patch.end());
|
||||
|
||||
|
|
@ -132,7 +133,7 @@ void test_triangulate_hole(const char* file_name) {
|
|||
|
||||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
|
||||
std::vector<Facet_handle> patch;
|
||||
CGAL::triangulate_hole(poly, *it, back_inserter(patch));
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch));
|
||||
if(patch.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
assert(false);
|
||||
|
|
@ -156,13 +157,13 @@ void test_triangulate_hole_should_be_no_output(const char* file_name) {
|
|||
|
||||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
|
||||
std::vector<Facet_handle> patch;
|
||||
CGAL::triangulate_hole(poly, *it, back_inserter(patch), false);
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), false);
|
||||
if(!patch.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
}
|
||||
|
||||
CGAL::triangulate_hole(poly, *it, back_inserter(patch), true);
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), true);
|
||||
if(!patch.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
assert(false);
|
||||
|
|
@ -182,7 +183,7 @@ void test_triangulate_and_refine_hole(const char* file_name) {
|
|||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
|
||||
std::vector<Facet_handle> patch_facets;
|
||||
std::vector<Vertex_handle> patch_vertices;
|
||||
CGAL::triangulate_and_refine_hole(poly, *it,
|
||||
CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly, *it,
|
||||
back_inserter(patch_facets), back_inserter(patch_vertices));
|
||||
|
||||
if(patch_facets.empty()) {
|
||||
|
|
@ -209,7 +210,8 @@ void test_triangulate_refine_and_fair_hole(const char* file_name) {
|
|||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it) {
|
||||
std::vector<Facet_handle> patch_facets;
|
||||
std::vector<Vertex_handle> patch_vertices;
|
||||
CGAL::triangulate_refine_and_fair_hole(poly, *it, back_inserter(patch_facets), back_inserter(patch_vertices));
|
||||
CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly,
|
||||
*it, back_inserter(patch_facets), back_inserter(patch_vertices));
|
||||
|
||||
if(patch_facets.empty()) {
|
||||
std::cerr << " Error: empty patch created." << std::endl;
|
||||
|
|
@ -238,10 +240,11 @@ void test_ouput_iterators_triangulate_hole(const char* file_name) {
|
|||
std::vector<Halfedge_handle>::iterator it_2 = border_reps_2.begin();
|
||||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it, ++it_2) {
|
||||
std::vector<Facet_handle> patch;
|
||||
CGAL::triangulate_hole(poly, *it, back_inserter(patch));
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch));
|
||||
|
||||
std::vector<Facet_handle> patch_2 = patch;
|
||||
Facet_handle* output_it = CGAL::triangulate_hole(poly_2, *it_2, &*patch_2.begin());
|
||||
Facet_handle* output_it =
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole(poly_2, *it_2, &*patch_2.begin());
|
||||
|
||||
if(patch.size() != (output_it - &*patch_2.begin())) {
|
||||
std::cerr << " Error: returned facet output iterator is not valid!" << std::endl;
|
||||
|
|
@ -266,14 +269,16 @@ void test_ouput_iterators_triangulate_and_refine_hole(const char* file_name) {
|
|||
for(std::vector<Halfedge_handle>::iterator it = border_reps.begin(); it != border_reps.end(); ++it, ++it_2) {
|
||||
std::vector<Facet_handle> patch_facets;
|
||||
std::vector<Vertex_handle> patch_vertices;
|
||||
CGAL::triangulate_and_refine_hole(poly, *it, back_inserter(patch_facets), back_inserter(patch_vertices));
|
||||
CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly,
|
||||
*it, back_inserter(patch_facets), back_inserter(patch_vertices));
|
||||
// create enough space to hold outputs
|
||||
std::vector<Facet_handle> patch_facets_2 = patch_facets;
|
||||
std::vector<Vertex_handle> patch_vertices_2 = patch_vertices;
|
||||
if(patch_vertices_2.empty()) { patch_vertices_2.push_back(Vertex_handle()); } //just allocate space for dereferencing
|
||||
|
||||
std::pair<Facet_handle*, Vertex_handle*> output_its =
|
||||
CGAL::triangulate_and_refine_hole(poly_2, *it_2, &*patch_facets_2.begin(), &*patch_vertices_2.begin());
|
||||
CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly_2,
|
||||
*it_2, &*patch_facets_2.begin(), &*patch_vertices_2.begin());
|
||||
|
||||
if(patch_facets.size() != (output_its.first - &*patch_facets_2.begin())) {
|
||||
std::cerr << " Error: returned facet output iterator is not valid!" << std::endl;
|
||||
|
|
@ -306,19 +311,19 @@ void test_triangulate_refine_and_fair_hole_compile() {
|
|||
|
||||
// use all param
|
||||
read_poly_with_borders("data/elephant_quad_hole.off", poly, border_reps);
|
||||
CGAL::triangulate_refine_and_fair_hole
|
||||
CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole
|
||||
(poly, border_reps[0], back_inserter(patch_facets), back_inserter(patch_vertices),
|
||||
CGAL::internal::Uniform_weight_fairing<Polyhedron>(poly), Default_solver());
|
||||
|
||||
// default solver
|
||||
read_poly_with_borders("data/elephant_quad_hole.off", poly, border_reps);
|
||||
CGAL::triangulate_refine_and_fair_hole
|
||||
CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole
|
||||
(poly, border_reps[0], back_inserter(patch_facets), back_inserter(patch_vertices),
|
||||
CGAL::internal::Uniform_weight_fairing<Polyhedron>(poly), CGAL::Default());
|
||||
|
||||
// default solver and weight
|
||||
read_poly_with_borders("data/elephant_quad_hole.off", poly, border_reps);
|
||||
CGAL::triangulate_refine_and_fair_hole
|
||||
CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole
|
||||
(poly, border_reps[0], back_inserter(patch_facets), back_inserter(patch_vertices));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,8 @@ void test_1(const char* file_name, bool use_DT) {
|
|||
read_polyline_one_line(file_name, points);
|
||||
|
||||
std::vector<boost::tuple<int, int, int> > tris;
|
||||
CGAL::triangulate_hole_polyline(points.begin(), --points.end(), std::back_inserter(tris), use_DT);
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(points.begin(),
|
||||
--points.end(), std::back_inserter(tris), use_DT);
|
||||
|
||||
check_triangles(points, tris);
|
||||
check_constructed_polyhedron(file_name, &tris, &points);
|
||||
|
|
@ -155,8 +156,8 @@ void test_2(const char* file_name, bool use_DT) {
|
|||
read_polyline_with_extra_points(file_name, points, extras);
|
||||
|
||||
std::vector<boost::tuple<int, int, int> > tris;
|
||||
CGAL::triangulate_hole_polyline(points.begin(), points.end(),
|
||||
extras.begin(), extras.end(), std::back_inserter(tris), use_DT);
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(points.begin(),
|
||||
points.end(), extras.begin(), extras.end(), std::back_inserter(tris), use_DT);
|
||||
|
||||
check_triangles(points, tris);
|
||||
check_constructed_polyhedron(file_name, &tris, &points);
|
||||
|
|
@ -171,7 +172,8 @@ void test_should_be_no_output(const char* file_name, bool use_DT) {
|
|||
read_polyline_one_line(file_name, points);
|
||||
|
||||
std::vector<boost::tuple<int, int, int> > tris;
|
||||
CGAL::triangulate_hole_polyline(points.begin(), points.end(), std::back_inserter(tris), use_DT);
|
||||
CGAL::Polygon_mesh_processing::triangulate_hole_polyline(
|
||||
points.begin(), points.end(), std::back_inserter(tris), use_DT);
|
||||
|
||||
if(!tris.empty()) {
|
||||
std::cerr << " Error: patch should be empty" << std::endl;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,9 @@
|
|||
#include "ui_Fairing_widget.h"
|
||||
#include "Polyhedron_type.h"
|
||||
|
||||
#include <CGAL/Hole_filling.h>
|
||||
#include <CGAL/iterator.h>
|
||||
#include <CGAL/Polygon_mesh_processing/fair.h>
|
||||
#include <CGAL/Polygon_mesh_processing/refine.h>
|
||||
|
||||
#include <QTime>
|
||||
#include <QAction>
|
||||
|
|
@ -74,14 +75,16 @@ public slots:
|
|||
CGAL::Fairing_continuity continuity = static_cast<CGAL::Fairing_continuity>(ui_widget.Continuity_spin_box->value());
|
||||
|
||||
if(weight_index == 1)
|
||||
CGAL::fair(*selection_item->polyhedron(), selection_item->selected_vertices.begin(),
|
||||
CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(),
|
||||
selection_item->selected_vertices.begin(),
|
||||
selection_item->selected_vertices.end(),
|
||||
CGAL::internal::Uniform_weight_fairing<Polyhedron>(),
|
||||
CGAL::internal::Uniform_weight_fairing<Polyhedron>(*selection_item->polyhedron()),
|
||||
continuity);
|
||||
if(weight_index == 0)
|
||||
CGAL::fair(*selection_item->polyhedron(), selection_item->selected_vertices.begin(),
|
||||
CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(),
|
||||
selection_item->selected_vertices.begin(),
|
||||
selection_item->selected_vertices.end(),
|
||||
CGAL::internal::Cotangent_weight_with_voronoi_area_fairing<Polyhedron>(),
|
||||
CGAL::internal::Cotangent_weight_with_voronoi_area_fairing<Polyhedron>(*selection_item->polyhedron()),
|
||||
continuity);
|
||||
selection_item->changed_with_poly_item();
|
||||
QApplication::restoreOverrideCursor();
|
||||
|
|
@ -98,8 +101,12 @@ public slots:
|
|||
double alpha = ui_widget.Density_control_factor_spin_box->value();
|
||||
std::vector<Polyhedron::Facet_handle> new_facets;
|
||||
|
||||
CGAL::refine(*selection_item->polyhedron(), selection_item->selected_facets.begin(),
|
||||
selection_item->selected_facets.end(), std::back_inserter(new_facets), CGAL::Emptyset_iterator(), alpha);
|
||||
CGAL::Polygon_mesh_processing::refine(*selection_item->polyhedron(),
|
||||
selection_item->selected_facets.begin(),
|
||||
selection_item->selected_facets.end(),
|
||||
std::back_inserter(new_facets),
|
||||
CGAL::Emptyset_iterator(),
|
||||
alpha);
|
||||
// add new facets to selection
|
||||
for(std::vector<Polyhedron::Facet_handle>::iterator it = new_facets.begin(); it != new_facets.end(); ++it) {
|
||||
selection_item->selected_facets.insert(*it);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "Polyhedron_type.h"
|
||||
#include <CGAL/gl_render.h>
|
||||
#include <CGAL/orient_polygon_soup.h>
|
||||
#include <CGAL/polygon_soup_to_polyhedron.h>
|
||||
#include <CGAL/polygon_soup_to_polygon_mesh.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <boost/foreach.hpp>
|
||||
|
|
|
|||
Loading…
Reference in New Issue