Subject: CGAL users discussion list
List archive
- From: sergio <>
- To:
- Subject: Re: [cgal-discuss] Detection of non_manifold_vertex in mesh
- Date: Wed, 6 Jun 2018 06:08:50 -0700 (MST)
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=SoftFail ; spf=Pass
- Ironport-phdr: 9a23:3szMORF74AjijZcXBYNSLp1GYnF86YWxBRYc798ds5kLTJ78ps2wAkXT6L1XgUPTWs2DsrQY07eQ6/iocFdDyK7JiGoFfp1IWk1NouQttCtkPvS4D1bmJuXhdS0wEZcKflZk+3amLRodQ56mNBXdrXKo8DEdBAj0OxZrKeTpAI7SiNm82/yv95HJbAhEmDqwbaluIBmqsA7cqtQYjYx+J6gr1xDHuGFIe+NYxWNpIVKcgRPx7dqu8ZBg7ipdpesv+9ZPXqvmcas4S6dYDCk9PGAu+MLrrxjDQhCR6XYaT24bjwBHAwnB7BH9Q5fxri73vfdz1SWGIcH7S60/VDK/5KlpVRDokj8KOTA5/m/JicJ/jqxbrg+uqBNjzIDZe52VOfhicq/BYd8WWXRNU8BMXCJBGIO8aI4PAvIaPelGtYn9qFoOrRyjDgSrGuPg0CNHhn7w3a013eQhFhvG3As7EtIBtXTbttT1NKMIXe+py6nIyCzOYvVL0jnz74jIdwouofCKXb9od8re01IgGBjBjlqOs4DqIzSV1uELvmOG7ORgTfqih3Mmpg1vuDSj2Mchh4fTio4IxF3J+z91zYQrKdC+VUV1e8SrEIFKuCGfL4Z2Qt0tQ2VvuCsizL0LtoS3fC4Qx5s83BHfb+KIf5KU7RLkUeadOTZ4hHR7d7Kjnxu+7EmtxvPmWsWq0FtHoDBJnsTCu30DzRDe6NaLRuN4/ki72DaP0w7T6vtDIUAxjafbNYQuzaIxlpoVvkTDECj2mF/xjKKNeUUk//Kn6+XjYrn8upCcMIp0hhnkMqsygsy/Hfg4Mg8WUmeH9uSzzrnj8VTkT7VLlf05jrTZsIvBJckAva64AwpV0p455BqlDjem1s4YnXgdI15fdhKHlduhB1abK//xCbKzgk+njSxw7/HAJLzoRJvXfVbZl7K0Zrtn5E9bgF4txNte4Z1aDasGCP32U0718tffC0lqYESP3+/7BYAlhcslUmWVD/rBafKAgRqz/usqZtK0SsoQsTf5JeIi4qe333A8kF4ZO6Ku2MlMMSzqLrFdO0ycJEHUrJIZC25T51gxSeXrjBuJVjsBPy/vDZJ53SkyDcedNamGRo2ph+XcjiHnWJtfbGpCBxaHFnK6Log=
Hello,
This is my implementation and checking with the file
cube_nonmanifold_vertex.off
OFF
10 13 0
-1 -1 -1
-1 1 -1
1 1 -1
1 -1 -1
-1 -1 1
-1 1 1
1 1 1
1 -1 1
*2 2 2
2 2 1*
3 0 1 3
3 3 1 2
3 0 4 1
3 1 4 5
3 3 2 7
3 7 2 6
3 4 0 3
3 7 4 3
3 6 4 7
3 6 5 4
3 1 5 6
3 2 1 6
*3 6 8 9*
we can check that after mesh is pass for polygon_soup_to_polygon_mesh the
non-manifold is remove. What I want to do is to detect the non manifold
vertex. What wrong?
#include <CGAL/Surface_mesh.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <iostream>
#include <fstream>
#include <list>
#include <CGAL/IO/OFF_reader.h>
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point;
typedef CGAL::Surface_mesh<Point> Mesh;
typedef Mesh::Face_index face_descriptor;
typedef typename Mesh::halfedge_index halfedge_descriptor;
bool getMeshFromPolygonSoup(const char* filename, Mesh &mesh)
{
std::ifstream input(filename);
if (!input)
{
std::cerr << "Cannot open file " << std::endl;
return false;
}
std::vector<Point> points;
std::vector< std::vector<std::size_t> > polygons;
if (!CGAL::read_OFF(input, points, polygons))
{
std::cerr << "Error parsing the OFF file " << std::endl;
return false;
}
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,
polygons, mesh);
return true;
}
void check_manifold_vertex(const Mesh& mesh)
{
std::set<face_descriptor> faces_;
BOOST_FOREACH(face_descriptor fd, faces(mesh)) {
// ids are between [0, number_of_segments -1]
faces_.insert(fd);
}
std::vector<halfedge_descriptor> boundary_hedges;
BOOST_FOREACH(face_descriptor fh, faces_)
{
std::cout << "halfedge" << std::endl;
halfedge_descriptor h = halfedge(fh, mesh);
for (int i = 0; i < 3; ++i)
{
std::cout << "vertex" <<i<< std::endl;
if (is_border(opposite(h, mesh), mesh) ||
faces_.count(face(opposite(h,
mesh), mesh)) == 0)
{
std::cout << "boundary edge" << std::endl;
boundary_hedges.push_back(h);
}
h = next(h, mesh);
}
}
}
int main(int, char** argv)
{
Mesh sm;
getMeshFromPolygonSoup(argv[1], sm);
check_manifold_vertex(sm);
return 0;
}
--
Sent from: http://cgal-discuss.949826.n4.nabble.com/
- [cgal-discuss] Detection of non_manifold_vertex in mesh, sergio, 06/05/2018
- Re: [cgal-discuss] Detection of non_manifold_vertex in mesh, Andreas Fabri, 06/05/2018
- Re: [cgal-discuss] Detection of non_manifold_vertex in mesh, sergio, 06/06/2018
- Re: [cgal-discuss] Detection of non_manifold_vertex in mesh, Andreas Fabri, 06/05/2018
Archive powered by MHonArc 2.6.18.