mirror of https://github.com/CGAL/cgal
Store selection in Status
This commit is contained in:
parent
ce678a62b9
commit
457ee55801
|
|
@ -12,6 +12,9 @@ if(OpenMesh_FOUND)
|
||||||
include(UseOpenMesh)
|
include(UseOpenMesh)
|
||||||
create_single_source_cgal_program("TriMesh.cpp")
|
create_single_source_cgal_program("TriMesh.cpp")
|
||||||
target_link_libraries(TriMesh PRIVATE ${OPENMESH_LIBRARIES})
|
target_link_libraries(TriMesh PRIVATE ${OPENMESH_LIBRARIES})
|
||||||
|
|
||||||
|
create_single_source_cgal_program("PolyMesh.cpp")
|
||||||
|
target_link_libraries(PolyMesh PRIVATE ${OPENMESH_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
message("NOTICE: This project requires OpenMesh and will not be compiled.")
|
message("NOTICE: This project requires OpenMesh and will not be compiled.")
|
||||||
endif()
|
endif()
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
|
||||||
|
|
||||||
|
#include <OpenMesh/Core/IO/MeshIO.hh>
|
||||||
|
#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
|
||||||
|
|
||||||
|
#include <CGAL/boost/graph/graph_traits_PolyMesh_ArrayKernelT.h>
|
||||||
|
#include <CGAL/boost/graph/iterator.h>
|
||||||
|
#include <CGAL/boost/graph/Euler_operations.h>
|
||||||
|
#include <CGAL/IO/polygon_mesh_io.h>
|
||||||
|
#include <CGAL/mesh_segmentation.h>
|
||||||
|
#include <CGAL/property_map.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
|
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
|
||||||
|
|
||||||
|
typedef OpenMesh::PolyMesh_ArrayKernelT</* MyTraits*/> Mesh;
|
||||||
|
|
||||||
|
typedef boost::graph_traits<Mesh>::vertex_descriptor vertex_descriptor;
|
||||||
|
typedef boost::graph_traits<Mesh>::face_descriptor face_descriptor;
|
||||||
|
typedef boost::graph_traits<Mesh>::halfedge_descriptor halfedge_descriptor;
|
||||||
|
|
||||||
|
int main(int argc, char** argv )
|
||||||
|
{
|
||||||
|
Mesh mesh;
|
||||||
|
|
||||||
|
std::vector<vertex_descriptor> V;
|
||||||
|
const std::string filename = (argc>1)?argv[1]:CGAL::data_file_path("meshes/in.off");
|
||||||
|
const char* outname= (argc>2)?argv[2]:"out.om";
|
||||||
|
CGAL::IO::read_polygon_mesh(filename, mesh);
|
||||||
|
|
||||||
|
mesh.request_vertex_status();
|
||||||
|
// typedef boost::property_map<Mesh, CGAL::dynamic_edge_property_t<int> >::type EdgeLabelMap;
|
||||||
|
// EdgeLabelMap elm = get(CGAL::dynamic_edge_property_t<int>(), mesh);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for(auto v : vertices(mesh)){
|
||||||
|
mesh.status(v).set_selected((i%2) == 0);
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
OpenMesh::IO::write_mesh(mesh, outname, OpenMesh::IO::Options::Status);
|
||||||
|
|
||||||
|
Mesh mesh2;
|
||||||
|
OpenMesh::IO::Options options;
|
||||||
|
bool read = OpenMesh::IO::read_mesh(mesh2, outname, options);
|
||||||
|
std::cout << num_vertices(mesh2) << std::endl;
|
||||||
|
assert(read);
|
||||||
|
if(options.vertex_has_status()){
|
||||||
|
for(auto v : vertices(mesh2)){
|
||||||
|
std::cout << std::boolalpha << mesh2.status(v).selected() << std::endl;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
std::cout << "no status" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue