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: Sat, 3 Dec 2016 13:18:31 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None

is_polygon_soup_a_polygon_mesh() gives true

On 2 December 2016 at 14:33, Sebastien Loriot (GeometryFactory) <> wrote:
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>






--
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