mirror of https://github.com/CGAL/cgal
parent
ff1244189f
commit
bcfd60e918
|
|
@ -14,7 +14,7 @@ typedef boost::associative_property_map<Facet_index_map> Facet_proxy_pmap;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// create polyhedral surface and read input surface triangle mesh
|
// read input surface triangle mesh
|
||||||
Polyhedron input;
|
Polyhedron input;
|
||||||
std::ifstream file("data/mask.off");
|
std::ifstream file("data/mask.off");
|
||||||
if (!file || !(file >> input) || input.empty()) {
|
if (!file || !(file >> input) || input.empty()) {
|
||||||
|
|
@ -32,7 +32,7 @@ int main()
|
||||||
fidx_map[f] = 0;
|
fidx_map[f] = 0;
|
||||||
Facet_proxy_pmap fpxmap(fidx_map);
|
Facet_proxy_pmap fpxmap(fidx_map);
|
||||||
|
|
||||||
// output plane proxies;
|
// output planar proxies
|
||||||
std::vector<Plane_proxy> proxies;
|
std::vector<Plane_proxy> proxies;
|
||||||
|
|
||||||
// free function interface with named parameters
|
// free function interface with named parameters
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// create polyhedral surface and read input surface triangle mesh
|
// read input surface triangle mesh
|
||||||
Polyhedron input;
|
Polyhedron input;
|
||||||
std::ifstream file("data/mask.off");
|
std::ifstream file("data/mask.off");
|
||||||
if (!file || !(file >> input) || input.empty()) {
|
if (!file || !(file >> input) || input.empty()) {
|
||||||
|
|
@ -18,7 +18,7 @@ int main()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// output polyhedral surface and indexed triangle mesh
|
// output polyhedral surface and indexed face set
|
||||||
Polyhedron output;
|
Polyhedron output;
|
||||||
std::vector<Kernel::Point_3> points;
|
std::vector<Kernel::Point_3> points;
|
||||||
std::vector<std::vector<std::size_t> > triangles; // triplets of indices
|
std::vector<std::vector<std::size_t> > triangles; // triplets of indices
|
||||||
|
|
@ -31,13 +31,13 @@ int main()
|
||||||
max_nb_proxies(200). // seeding with maximum number of proxies
|
max_nb_proxies(200). // seeding with maximum number of proxies
|
||||||
nb_of_iterations(30). // number of clustering iterations after seeding
|
nb_of_iterations(30). // number of clustering iterations after seeding
|
||||||
// output to polyhedron
|
// output to polyhedron
|
||||||
output_mesh(&output)); // valid only if the indexed triangles construct a 2-manifold and oriented surface
|
output_mesh(&output)); // valid when the indexed face set represents a 2-manifold, oriented surface
|
||||||
|
|
||||||
std::cout << "#anchor points: " << points.size() << std::endl;
|
std::cout << "#anchor points: " << points.size() << std::endl;
|
||||||
std::cout << "#triangles: " << triangles.size() << std::endl;
|
std::cout << "#triangles: " << triangles.size() << std::endl;
|
||||||
|
|
||||||
if (valid_polyhedron)
|
if (valid_polyhedron)
|
||||||
std::cout << "oriented 2-manifold output." << std::endl;
|
std::cout << "oriented, 2-manifold output." << std::endl;
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ typedef Mesh_approximation::Proxy_fitting Proxy_fitting;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// create polyhedral surface and read input mesh
|
// read input surface triangle mesh
|
||||||
Polyhedron input;
|
Polyhedron input;
|
||||||
std::ifstream file("data/mask.off");
|
std::ifstream file("data/mask.off");
|
||||||
if (!file || !(file >> input) || input.empty()) {
|
if (!file || !(file >> input) || input.empty()) {
|
||||||
|
|
@ -26,7 +26,7 @@ int main()
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// create VSA approximation algorithm instance
|
// create VSA algorithm instance
|
||||||
Mesh_approximation approx(input,
|
Mesh_approximation approx(input,
|
||||||
get(boost::vertex_point, const_cast<Polyhedron &>(input)));
|
get(boost::vertex_point, const_cast<Polyhedron &>(input)));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,16 +24,19 @@ int main()
|
||||||
Facet_index_map fidx_map;
|
Facet_index_map fidx_map;
|
||||||
BOOST_FOREACH(face_descriptor f, faces(input))
|
BOOST_FOREACH(face_descriptor f, faces(input))
|
||||||
fidx_map[f] = 0;
|
fidx_map[f] = 0;
|
||||||
|
|
||||||
// facet proxy index property map
|
// facet proxy index property map
|
||||||
Facet_proxy_pmap fpxmap(fidx_map);
|
Facet_proxy_pmap fpxmap(fidx_map);
|
||||||
|
|
||||||
// free function interface with named parameters
|
// free function interface with named parameters
|
||||||
CGAL::VSA::mesh_segmentation(input,
|
CGAL::VSA::mesh_segmentation(input,
|
||||||
fpxmap, // output indexed face set
|
fpxmap, // output segmentation
|
||||||
CGAL::VSA::parameters::seeding_method(CGAL::VSA::Hierarchical). // hierarchical seeding
|
CGAL::VSA::parameters::seeding_method(CGAL::VSA::Hierarchical). // hierarchical seeding
|
||||||
max_nb_proxies(200). // both maximum number of proxies stop criterion,
|
max_nb_proxies(200). // first stop criterion
|
||||||
min_error_drop(0.05). // and minimum error drop stop criterion are specified
|
min_error_drop(0.05). // second stop criterion
|
||||||
nb_of_iterations(30)); // number of iterations after seeding
|
nb_of_iterations(30)); // number of iterations after seeding
|
||||||
|
|
||||||
|
// TODO: retrieve segments of the segmentation
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,12 +10,11 @@ typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
// create polyhedral surface and read input surface triangle mesh
|
// read input surface triangle mesh
|
||||||
Polyhedron input;
|
Polyhedron input;
|
||||||
std::ifstream file("data/mask.off");
|
std::ifstream file("data/mask.off");
|
||||||
file >> input;
|
file >> input;
|
||||||
|
|
||||||
|
|
||||||
// The output will be an indexed triangle mesh
|
// The output will be an indexed triangle mesh
|
||||||
std::vector<Kernel::Point_3> points;
|
std::vector<Kernel::Point_3> points;
|
||||||
std::vector<std::vector<std::size_t> > triangles;
|
std::vector<std::vector<std::size_t> > triangles;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue