mirror of https://github.com/CGAL/cgal
use overlod API examples
This commit is contained in:
parent
0342f1ec5b
commit
21115f74d0
|
|
@ -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.
|
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
|
\subsection ApproximationExample_2 User-defined Proxy
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,5 +41,5 @@ include_directories( BEFORE ../../include )
|
||||||
|
|
||||||
include( CGAL_CreateSingleSourceCGALProgram )
|
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")
|
create_single_source_cgal_program( "vsa_metric_example.cpp")
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ int main(int argc, char *argv[])
|
||||||
Polyhedron mesh;
|
Polyhedron mesh;
|
||||||
std::ifstream input(argv[1]);
|
std::ifstream input(argv[1]);
|
||||||
if (!input || !(input >> mesh) || mesh.empty()) {
|
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;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,33 +57,20 @@ int main(int argc, char *argv[])
|
||||||
FacetAreaMap area_pmap(facet_areas);
|
FacetAreaMap area_pmap(facet_areas);
|
||||||
VertexPointMap point_pmap = get(boost::vertex_point, const_cast<Polyhedron &>(mesh));
|
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_proxies = std::atoi(argv[3]);
|
||||||
const std::size_t num_iterations = std::atoi(argv[4]);
|
const std::size_t num_iterations = std::atoi(argv[4]);
|
||||||
std::vector<int> tris;
|
std::vector<int> tris;
|
||||||
std::vector<Kernel::Point_3> anchor_pos;
|
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]);
|
int init = std::atoi(argv[2]);
|
||||||
if (init < 0 || init > 3)
|
if (init < 0 || init > 3)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
CGAL::vsa_mesh_approximation(init, mesh,
|
CGAL::vsa_mesh_approximation(mesh,
|
||||||
num_proxies,
|
|
||||||
num_iterations,
|
|
||||||
proxy_patch_map,
|
|
||||||
point_pmap,
|
|
||||||
tris,
|
tris,
|
||||||
anchor_pos,
|
anchor_pos,
|
||||||
anchor_vtx,
|
L21ApproximationTrait(mesh, point_pmap, normal_pmap, area_pmap),
|
||||||
bdrs,
|
init,
|
||||||
L21ApproximationTrait(mesh, point_pmap, normal_pmap, area_pmap));
|
num_proxies,
|
||||||
|
num_iterations);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ int main(int argc, char *argv[])
|
||||||
Polyhedron mesh;
|
Polyhedron mesh;
|
||||||
std::ifstream input(argv[1]);
|
std::ifstream input(argv[1]);
|
||||||
if (!input || !(input >> mesh) || mesh.empty()) {
|
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;
|
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_proxies = std::atoi(argv[3]);
|
||||||
const std::size_t num_iterations = std::atoi(argv[4]);
|
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]);
|
int init = std::atoi(argv[2]);
|
||||||
if (init < 0 || init > 3)
|
if (init < 0 || init > 3)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
CGAL::vsa_mesh_approximation(init, mesh,
|
CGAL::vsa_mesh_approximation(mesh,
|
||||||
num_proxies,
|
|
||||||
num_iterations,
|
|
||||||
proxy_patch_map,
|
proxy_patch_map,
|
||||||
point_pmap,
|
ApproxTrait(mesh, point_pmap, center_pmap, area_pmap, normal_pmap),
|
||||||
tris,
|
init,
|
||||||
anchor_pos,
|
num_proxies,
|
||||||
anchor_vtx,
|
num_iterations);
|
||||||
bdrs,
|
|
||||||
ApproxTrait(mesh, point_pmap, center_pmap, area_pmap, normal_pmap));
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue