mirror of https://github.com/CGAL/cgal
Add is_triangle_mesh test in Surface_mesh_segmentation package
This commit is contained in:
parent
931ea6a0d0
commit
7c3e5af35a
|
|
@ -16,8 +16,8 @@ int main()
|
|||
// create and read Polyhedron
|
||||
Polyhedron mesh;
|
||||
std::ifstream input("data/cactus.off");
|
||||
if ( !input || !(input >> mesh) || mesh.empty() ) {
|
||||
std::cerr << "Not a valid off file." << std::endl;
|
||||
if ( !input || !(input >> mesh) || mesh.empty() || ( !CGAL::is_triangle_mesh(mesh)) ) {
|
||||
std::cerr << "Input is not a triangle mesh" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -48,4 +48,5 @@ int main()
|
|||
std::cout << sdf_property_map[facet_it] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,11 @@ int main(int argc, char** argv )
|
|||
OpenMesh::IO::read_mesh(mesh, argv[1]);
|
||||
else
|
||||
OpenMesh::IO::read_mesh(mesh, "data/cactus.off");
|
||||
|
||||
|
||||
if (!CGAL::is_triangle_mesh(mesh)){
|
||||
std::cerr << "Input geometry is not triangulated." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
std::cout << "#F : " << num_faces(mesh) << std::endl;
|
||||
std::cout << "#H : " << num_halfedges(mesh) << std::endl;
|
||||
std::cout << "#V : " << num_vertices(mesh) << std::endl;
|
||||
|
|
@ -65,4 +69,5 @@ int main(int argc, char** argv )
|
|||
// Note that we can use the same SDF values (sdf_property_map) over and over again for segmentation.
|
||||
// This feature is relevant for segmenting the mesh several times with different parameters.
|
||||
CGAL::segmentation_from_sdf_values(mesh, sdf_property_map, segment_property_map, number_of_clusters, smoothing_lambda);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ int main(int argc, char** argv )
|
|||
std::ifstream cactus("data/cactus.off");
|
||||
cactus >> mesh;
|
||||
}
|
||||
if (!CGAL::is_triangle_mesh(mesh)){
|
||||
std::cerr << "Input geometry is not triangulated." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
typedef Mesh::Property_map<face_descriptor,double> Facet_double_map;
|
||||
Facet_double_map sdf_property_map;
|
||||
|
||||
|
|
@ -62,4 +66,5 @@ int main(int argc, char** argv )
|
|||
// Note that we can use the same SDF values (sdf_property_map) over and over again for segmentation.
|
||||
// This feature is relevant for segmenting the mesh several times with different parameters.
|
||||
CGAL::segmentation_from_sdf_values(mesh, sdf_property_map, segment_property_map, number_of_clusters, smoothing_lambda);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ int main()
|
|||
// create and read Polyhedron
|
||||
Polyhedron mesh;
|
||||
std::ifstream input("data/cactus.off");
|
||||
if ( !input || !(input >> mesh) || mesh.empty() ) {
|
||||
std::cerr << "Not a valid off file." << std::endl;
|
||||
if ( !input || !(input >> mesh) || mesh.empty() || ( !CGAL::is_triangle_mesh(mesh))) {
|
||||
std::cerr << "Input is not a triangle mesh." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
|
@ -54,4 +54,6 @@ int main()
|
|||
// This feature is relevant for segmenting the mesh several times with different parameters.
|
||||
CGAL::segmentation_from_sdf_values(
|
||||
mesh, sdf_property_map, segment_property_map, number_of_clusters, smoothing_lambda);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ int main()
|
|||
// create and read Polyhedron
|
||||
Polyhedron mesh;
|
||||
std::ifstream input("data/cactus.off");
|
||||
if ( !input || !(input >> mesh) || mesh.empty() ) {
|
||||
if ( !input || !(input >> mesh) || mesh.empty() || ( !CGAL::is_triangle_mesh(mesh)) ) {
|
||||
std::cerr << "Not a valid off file." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -37,4 +37,5 @@ int main()
|
|||
std::cout << segment_property_map[facet_it] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ int main()
|
|||
// create and read Polyhedron
|
||||
Polyhedron mesh;
|
||||
std::ifstream input("data/cactus.off");
|
||||
if ( !input || !(input >> mesh) || mesh.empty() ) {
|
||||
if ( !input || !(input >> mesh) || mesh.empty() || ( !CGAL::is_triangle_mesh(mesh)) ) {
|
||||
std::cerr << "Not a valid off file." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
@ -76,4 +76,5 @@ int main()
|
|||
std::cout << segment_property_map[facet_it] << " ";
|
||||
}
|
||||
std::cout << std::endl;
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue