Subject: CGAL users discussion list
List archive
Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?
Chronological Thread
- From: "Sebastien Loriot (GeometryFactory)" <>
- To:
- Subject: Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?
- Date: Fri, 2 Dec 2016 13:33:58 +0100
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
- Ironport-phdr: 9a23:zH/BTBBLdkHYA00h47JcUyQJP3N1i/DPJgcQr6AfoPdwSP7+pcbcNUDSrc9gkEXOFd2CrakV0KyK6Ou5CSRAuc/H6y9SNsQUFlcssoY/oU8JOIa9E0r1LfrnPWQRPf9pcxtbxUy9KlVfA83kZlff8TWY5D8WHQjjZ0IufrymUt2assKsyurn+4HPex4aw32mcLZqJVO3qx/Qv48Ym8x5O6Mpw1zIpHVPPO9ZzGctKVOIlAvn/ZSM+8to/C1U/v4g7MVdSr7SfqIiTLUeAi51HXoy4ZihjhTJRBCT53YaGkERiBtPH0CFwxz9W5rtqDrUv+Fh3zOLfIe+GaswXi6j6LstTRvAhyIONjp/+2bS3J8jxJlHqQ6s8kQsi7XfZ5uYYaJz
- Organization: GeometryFactory
Try is_polygon_soup_a_polygon_mesh().
http://doc.cgal.org/latest/Polygon_mesh_processing/group__PMP__repairing__grp.html#ga8b9d12d817b5cc76f5a42d74eac75bf3
Sebastien.
On 12/02/2016 12:25 PM, Iason Manolas wrote:
I used the cactus.off as in the example of mesh segmentation and I get
that the number of segments is 3 which sounds right.. So something must
be wrong with my polyhedron. I use the following code to build it from a
vector of vertices and a vector of indices:
void buildPolyhedron()
{
P.clear();
std::cout<<"Building Polyhedron.."<<std::endl;
std::vector<Kernel::Point_3> points;
std::vector<std::vector<std::size_t>> polygons;
for(auto const& vert:vertices)
{
points.push_back(Kernel::Point_3(vert.Position.x,vert.Position.y,vert.Position.z));
}
for(int i=0;i<indices.size();i+=3)
{
std::vector<std::size_t> tri{indices[i],indices[i+1],indices[i+2]};
polygons.push_back(tri);
}
CGAL::Polygon_mesh_processing::orient_polygon_soup(points,polygons);
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh(points,polygons,P);
if (CGAL::is_closed(P) &&
(!CGAL::Polygon_mesh_processing::is_outward_oriented(P)))
CGAL::Polygon_mesh_processing::reverse_face_orientations(P);
CGAL::Polygon_mesh_processing::compute_vertex_normals(P,boost::make_assoc_property_map(normalsMap));
std::cout<<"Finished building Polyhedron."<<std::endl;
}
Could it be that
CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh constructs
an "inappropriate" Polyhedron for CGAL::segmentation_via_sdf_values?
On 21 November 2016 at 13:10, Iason Manolas
<
<mailto:>>
wrote:
Unfortunately since my code deals with 3d models there are some
dependencies and the code is not that small. I tried to make it as
short as possible though.
Except cgal,gmp,boost I use assimp.
<http://www.assimp.org/>
Find the code reproducing the problem here
<https://github.com/IasonManolas/CGAL_meshSegm_problem> and please
don't hesitate to write back if you think I neglected something.
Regards,
Iason
On 21 November 2016 at 10:45, Sebastien Loriot (GeometryFactory)
<
<mailto:>>
wrote:
Could you share a minimal example that we can run and that would
show the pb?
Thanks,
Sebastien.
On 11/18/2016 12:41 PM, Iason Manolas wrote:
Hello ,
I am trying to segment a polyhedron using the following code:
void meshSegmentation()
{
std::cout<<"Segmenting Mesh.."<<std::endl;
using
Facet_int_map=std::map<CGALPolyhedron::Facet_const_handle,std::size_t>;
Facet_int_map internal_segment_map;
boost::associative_property_map<Facet_int_map>
segment_property_map(internal_segment_map);
std::size_t
number_of_segments=CGAL::segmentation_via_sdf_values(P,segment_property_map);
std::cout<<"Number of segments:
"<<number_of_segments<<std::endl;
std::cout<<"Segmentation finished."<<std::endl;
}
(I have previously checked that the P.is_valid()==1)
Why is the number of segments always equal to the number of
faces?
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss
<https://sympa.inria.fr/sympa/info/cgal-discuss>
- Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?, Iason Manolas, 12/02/2016
- Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?, Sebastien Loriot (GeometryFactory), 12/02/2016
- Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?, Iason Manolas, 12/03/2016
- Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?, Sebastien Loriot (GeometryFactory), 12/02/2016
Archive powered by MHonArc 2.6.18.