use overlod API examples

This commit is contained in:
Lingjie Zhu 2017-07-24 17:08:25 +08:00
parent 0342f1ec5b
commit 21115f74d0
4 changed files with 14 additions and 35 deletions

View File

@ -26,7 +26,7 @@ Approximate a triangle mesh and extract the approximated triangle surface, using
The following example calls the functions `CGAL::vsa_mesh_approximation()` on the input triangle mesh.
\cgalExample{Surface_mesh_approximation/vsa_example.cpp}
\cgalExample{Surface_mesh_approximation/vsa_extraction_example.cpp}
\subsection ApproximationExample_2 User-defined Proxy

View File

@ -41,5 +41,5 @@ include_directories( BEFORE ../../include )
include( CGAL_CreateSingleSourceCGALProgram )
create_single_source_cgal_program( "vsa_example.cpp" )
create_single_source_cgal_program( "vsa_extraction_example.cpp" )
create_single_source_cgal_program( "vsa_metric_example.cpp")

View File

@ -36,7 +36,7 @@ int main(int argc, char *argv[])
Polyhedron mesh;
std::ifstream input(argv[1]);
if (!input || !(input >> mesh) || mesh.empty()) {
std::cerr << "Not a valid off file." << std::endl;
std::cerr << "Invalid off file." << std::endl;
return EXIT_FAILURE;
}
@ -57,33 +57,20 @@ int main(int argc, char *argv[])
FacetAreaMap area_pmap(facet_areas);
VertexPointMap point_pmap = get(boost::vertex_point, const_cast<Polyhedron &>(mesh));
// create a property-map for segment-ids
typedef std::map<Facet_const_handle, std::size_t> Facet_id_map;
Facet_id_map internal_facet_id_map;
for (Facet_const_iterator fitr = mesh.facets_begin(); fitr != mesh.facets_end(); ++fitr)
internal_facet_id_map.insert(std::pair<Facet_const_handle, std::size_t>(fitr, 0));
boost::associative_property_map<Facet_id_map> proxy_patch_map(internal_facet_id_map);
const std::size_t num_proxies = std::atoi(argv[3]);
const std::size_t num_iterations = std::atoi(argv[4]);
std::vector<int> tris;
std::vector<Kernel::Point_3> anchor_pos;
std::vector<Polyhedron::Vertex_handle> anchor_vtx;
std::vector<std::vector<std::size_t> > bdrs;
int init = std::atoi(argv[2]);
if (init < 0 || init > 3)
return EXIT_FAILURE;
CGAL::vsa_mesh_approximation(init, mesh,
num_proxies,
num_iterations,
proxy_patch_map,
point_pmap,
CGAL::vsa_mesh_approximation(mesh,
tris,
anchor_pos,
anchor_vtx,
bdrs,
L21ApproximationTrait(mesh, point_pmap, normal_pmap, area_pmap));
L21ApproximationTrait(mesh, point_pmap, normal_pmap, area_pmap),
init,
num_proxies,
num_iterations);
return EXIT_SUCCESS;
}

View File

@ -138,7 +138,7 @@ int main(int argc, char *argv[])
Polyhedron mesh;
std::ifstream input(argv[1]);
if (!input || !(input >> mesh) || mesh.empty()) {
std::cerr << "Not a valid off file." << std::endl;
std::cerr << "Invalid off file." << std::endl;
return EXIT_FAILURE;
}
@ -171,23 +171,15 @@ int main(int argc, char *argv[])
const std::size_t num_proxies = std::atoi(argv[3]);
const std::size_t num_iterations = std::atoi(argv[4]);
std::vector<int> tris;
std::vector<Kernel::Point_3> anchor_pos;
std::vector<Polyhedron::Vertex_handle> anchor_vtx;
std::vector<std::vector<std::size_t> > bdrs;
int init = std::atoi(argv[2]);
if (init < 0 || init > 3)
return EXIT_FAILURE;
CGAL::vsa_mesh_approximation(init, mesh,
num_proxies,
num_iterations,
CGAL::vsa_mesh_approximation(mesh,
proxy_patch_map,
point_pmap,
tris,
anchor_pos,
anchor_vtx,
bdrs,
ApproxTrait(mesh, point_pmap, center_pmap, area_pmap, normal_pmap));
ApproxTrait(mesh, point_pmap, center_pmap, area_pmap, normal_pmap),
init,
num_proxies,
num_iterations);
return EXIT_SUCCESS;
}