initial API

This commit is contained in:
Lingjie Zhu 2017-07-09 16:47:35 +08:00
parent f8b19da416
commit f618632033
1 changed files with 28 additions and 13 deletions

View File

@ -1,7 +1,7 @@
#ifndef CGAL_SURFACE_MESH_APPROXIMATION_VSA_MESH_APPROXIMATION_H
#define CGAL_SURFACE_MESH_APPROXIMATION_VSA_MESH_APPROXIMATION_H
#include "VSA.h"
#include <CGAL/internal/Surface_mesh_approximation/VSA.h>
#include <CGAL/property_map.h>
namespace CGAL
@ -10,22 +10,37 @@ namespace CGAL
\ingroup PkgTSMA
Main function
*/
template <typename TriangleMesh,
template<typename TriangleMesh,
typename SegmentPropertyMap,
typename FittingPropertyMap,
typename PointPropertyMap
= typename boost::property_map<TriangleMesh, boost::vertex_point_t>::type,
typename GeomTraits
= typename Kernel_traits<typename boost::property_traits<PointPropertyMap>::value>::Kernel>
typename PointPropertyMap,
typename AnchorIndexContainer,
typename AnchorPositionContainer,
typename AnchorVertexContainer,
typename BoundaryContainer,
typename GeomTraits>
void vsa_mesh_approximation(const TriangleMesh &triangle_mesh,
const std::size_t number_of_segments,
const std::size_t number_of_iterations,
SegmentPropertyMap segment_ids,
FittingPropertyMap fit_error_map = FittingPropertyMap(),
PointPropertyMap ppmap = PointPropertyMap(),
GeomTraits traits = GeomTraits()) {
internal::VSA<TriangleMesh, PointPropertyMap, GeomTraits>
algorithm(triangle_mesh, ppmap, traits);
algorithm.partition(number_of_segments, segment_ids);
PointPropertyMap ppmap,
AnchorIndexContainer &tris,
AnchorPositionContainer &pos,
AnchorVertexContainer &vtx,
BoundaryContainer &bdrs,
GeomTraits traits) {
typedef CGAL::internal::VSA<TriangleMesh, GeomTraits, PointPropertyMap> VSA;
VSA algorithm(triangle_mesh, ppmap, traits);
algorithm.partition(number_of_segments, number_of_iterations, segment_ids);
algorithm.extract_mesh(segment_ids, tris);
BOOST_FOREACH(const typename VSA::Anchor &a, algorithm.collect_anchors()) {
vtx.push_back(a.vtx);
pos.push_back(a.pos);
}
bdrs = algorithm.collect_borders(segment_ids);
}
}