Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?

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: Iason Manolas <>
  • To:
  • Subject: Re: [cgal-discuss] Mesh segmentation: Why is number_of_segments==number_of faces on any model?
  • Date: Fri, 2 Dec 2016 13:25:55 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:DnQvDRNRwa6L/ndhaE4l6mtUPXoX/o7sNwtQ0KIMzox0KP78rarrMEGX3/hxlliBBdydsKMfzbaN+Pm4ESxYuNDa7yBEKMQNHzY+yuwo3CUYSPafDkP6KPO4JwcbJ+9lEGFfwnegLEJOE9z/bVCB6le77DoVBwmtfVEtfre9Scbvid+q3bWy54HLeFcPwyGsZKt7ahSwtwTY8McMxpBzL744jRrPrHwPcOtfwSZkJEmYgg3ntfu3qZVs+iAVt/M6/NNbSo37eb45RPpWFmcIKWcwsezirh7FBS6G4HwYW35exgNRHw/B4Rf3dpj0uyr+8OF63X/JboXNUbkoVGH6vO9QQxjyhXJfOg==

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 <> 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.
Find the code reproducing the problem here 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) <> 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







Archive powered by MHonArc 2.6.18.

Top of Page