small corrections on docs and test files

This commit is contained in:
Konstantinos Katrioplas 2018-06-08 12:00:28 +02:00
parent e85196b737
commit 6cb1dbe4d4
4 changed files with 20 additions and 63 deletions

View File

@ -26,8 +26,6 @@
#include <vector>
#include <set>
#include <fstream>
#include <string>
#include <boost/graph/graph_traits.hpp>
#include <boost/foreach.hpp>
#include <boost/property_map/property_map.hpp>
@ -77,9 +75,9 @@ public:
#endif
}
void extract_angles(const char* filename)
template <typename Stream>
void extract_angles(Stream& output)
{
std::ofstream output(filename);
for(unsigned int i=0; i!=angles_.size(); ++i)
output << angles_[i] << std::endl;
output.close();
@ -95,9 +93,9 @@ public:
#endif
}
void extract_areas(const char* filename)
template <typename Stream>
void extract_areas(Stream& output)
{
std::ofstream output(filename);
for(unsigned int i=0; i!=areas_.size(); ++i)
output << areas_[i] << std::endl;
output.close();
@ -130,9 +128,9 @@ public:
#endif
}
void extract_aspect_ratios(const char* filename)
template <typename Stream>
void extract_aspect_ratios(Stream& output)
{
std::ofstream output(filename);
for(unsigned int i=0; i!=aspect_ratios_.size(); ++i)
output << aspect_ratios_[i] << std::endl;
output.close();

View File

@ -46,9 +46,6 @@ namespace Polygon_mesh_processing {
* after each iteration.
*
* @tparam PolygonMesh model of `MutableFaceGraph`.
* If `PolygonMesh` has an internal property map for `CGAL::face_index_t`,
* and no `face_index_map` is given
* as a named parameter, then the internal one should be initialized.
* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
model of `Range`. Its iterator type is `ForwardIterator`.
* @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters".
@ -182,9 +179,6 @@ void smooth_angles(PolygonMesh& pmesh)
* Optionally, the points are reprojected after each iteration.
*
* @tparam PolygonMesh model of `MutableFaceGraph`.
* If `PolygonMesh` has an internal property map for `CGAL::face_index_t`,
* and no `face_index_map` is given
* as a named parameter, then the internal one should be initialized.
* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
model of `Range`. Its iterator type is `ForwardIterator`.
* @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters"
@ -313,30 +307,32 @@ void smooth_areas(PolygonMesh& pmesh)
}
// not documented
template<typename PolygonMesh, typename GeomTraits>
void angles_evaluation(PolygonMesh& pmesh, const char* filename)
///\cond SKIP_IN_MANUAL
template<typename PolygonMesh, typename GeomTraits, typename Stream>
void angles_evaluation(PolygonMesh& pmesh, GeomTraits, Stream& output)
{
internal::Quality_evaluator<PolygonMesh, GeomTraits> evaluator(pmesh);
evaluator.gather_angles();
evaluator.extract_angles(filename);
evaluator.extract_angles(output);
}
template<typename PolygonMesh, typename GeomTraits>
void areas_evaluation(PolygonMesh& pmesh, const char* filename)
template<typename PolygonMesh, typename GeomTraits, typename Stream>
void areas_evaluation(PolygonMesh& pmesh, GeomTraits, Stream& output)
{
internal::Quality_evaluator<PolygonMesh, GeomTraits> evaluator(pmesh);
evaluator.measure_areas();
evaluator.extract_areas(filename);
evaluator.extract_areas(output);
}
template<typename PolygonMesh, typename GeomTraits>
void aspect_ratio_evaluation(PolygonMesh& pmesh, const char* filename)
template<typename PolygonMesh, typename GeomTraits, typename Stream>
void aspect_ratio_evaluation(PolygonMesh& pmesh, GeomTraits, Stream& output)
{
internal::Quality_evaluator<PolygonMesh, GeomTraits> evaluator(pmesh);
evaluator.calc_aspect_ratios();
evaluator.extract_aspect_ratios(filename);
evaluator.extract_aspect_ratios(output);
}
///\cond SKIP_IN_MANUAL
} // namespace Polygon_mesh_processing
} // namespace CGAL

View File

@ -136,9 +136,6 @@ void smooth_curvature_flow_explicit(const FaceRange& faces, PolygonMesh& pmesh,
*
*
* @tparam PolygonMesh model of `MutableFaceGraph`.
* If `PolygonMesh` has an internal property map for `CGAL::face_index_t`,
* and no `face_index_map` is given
* as a named parameter, then the internal one should be initialized.
* @tparam FaceRange range of `boost::graph_traits<PolygonMesh>::%face_descriptor`,
* model of `Range`. Its iterator type is `ForwardIterator`.
* @tparam NamedParameters a sequence of \ref pmp_namedparameters "Named Parameters"

View File

@ -3,6 +3,7 @@
#include <CGAL/Polyhedron_3.h>
#include <CGAL/Polygon_mesh_processing/smooth_mesh.h>
#include <boost/graph/graph_traits.hpp>
#include <CGAL/property_map.h>
#include <fstream>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
@ -10,41 +11,6 @@ typedef Kernel::Point_3 Point;
typedef CGAL::Surface_mesh<Point> SurfaceMesh;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
template<typename Mesh>
struct Constraints_pmap
{
typedef typename boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
typedef vertex_descriptor key_type;
typedef bool value_type;
typedef value_type& reference;
typedef boost::read_write_property_map_tag category;
std::set<vertex_descriptor>* set_ptr_;
public:
Constraints_pmap(std::set<vertex_descriptor>* set_ptr)
: set_ptr_(set_ptr)
{}
Constraints_pmap()
: set_ptr_(NULL)
{}
friend value_type get(const Constraints_pmap& map, const key_type& v)
{
CGAL_assertion(map.set_ptr_ != NULL);
return !map.set_ptr_->empty()
&& map.set_ptr_->count(v);
}
friend void put(Constraints_pmap& map
, const key_type& v, const value_type is)
{
CGAL_assertion(map.set_ptr_ != NULL);
if (is) map.set_ptr_->insert(v);
else if(get(map, v)) map.set_ptr_->erase(v);
}
};
template <typename Mesh>
void test_angle_smoothing(const char* filename)
@ -193,7 +159,7 @@ void test_constrained_vertices(const char* filename)
z_init = get(vpmap, v).z();
}
}
Constraints_pmap<Mesh> vcmap(&selected_vertices);
CGAL::Boolean_property_map<std::set<vertex_descriptor> > vcmap(selected_vertices);
CGAL::Polygon_mesh_processing::smooth_angles(mesh,
CGAL::Polygon_mesh_processing::parameters::vertex_is_constrained_map(vcmap));