Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] Finding adjacent segments from SDF Mesh Segmentation

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] Finding adjacent segments from SDF Mesh Segmentation


Chronological Thread 
  • From: Sukhraj Singh <>
  • To:
  • Subject: Re: [cgal-discuss] Finding adjacent segments from SDF Mesh Segmentation
  • Date: Fri, 24 Jun 2016 21:31:06 +0530
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:nRdYoB/wEs0/bv9uRHKM819IXTAuvvDOBiVQ1KB92uscTK2v8tzYMVDF4r011RmSDN2ds6IP2rOempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47AblHf6ke/8SQVUk2mc1EkfqKtSsWD1oye7KObw9XreQJGhT6wM/tZDS6dikHvjPQQmpZoMa0ryxHE8TNicuVSwn50dxrIx06vrpT4wZh47i4Fu+4979USFuLhbqEgRPpZCi4nOiY7/orwpBzbREyO4HUbFW4Zmx4NDwne5wzhRcTNtX7xueN5nSWbJsbrVqscWDK47q4tRgW7pj0AMmsC7WLXkMVyxJlaph2h70hkwojbYMeOKfl+ZKrfVdwfTGtFGM1WUnoSUcuHc4ITAr9Zbq5jpI7nqg5WoA==

Yes, that could be one approach, your reply has bolstered my thought , Thanks :)
The facet iteration is not like hopping between neighboring facets ....

On Fri, Jun 24, 2016 at 9:02 PM, Sebastien Loriot (GeometryFactory) <> wrote:
Iterate over edges and connect if the two faces incident
do not belong to the same segment then put a 1 in
the matrix.

Sebastien.


On 06/24/2016 05:00 PM, Sukhraj Singh wrote:
Hello,

I am trying to create an adjacency matrix for the segments.(undirected)

I tried following code snippet, (the code isnt perfect though)
The segment_ids ,contains the ids of the segments, its populated in the
Surface Mesh Segmentation Plugin.
====================================================================================


     int  current_segment  =  -1;

     int  prev_segment  =  -1;


     int  adjmat[10][10]  =  {0};

     for(Polyhedron::Facet_iterator  facet_it  =  polyhedron->facets_begin();

         facet_it  !=  polyhedron->facets_end();  ++facet_it)

     {

         current_segment  =  segment_ids[facet_it];

         if(current_segment  !=  prev_segment)

         {

             //std::cout  <<  std::endl;

             //std::cout  <<  "  segment:  "<<  prev_segment  <<  "  and  "  <<  "  segment:  "  <<  current_segment;

             //std::cout  <<  "  Are  adjacent"  <<  std::endl;

             adjmat[current_segment][prev_segment]  =  1;

             prev_segment  =  current_segment;


         }

     }

===========================================================================================

The output of adjmat is

0 1 1 1 1 1 0 0 0 1
1 0 1 1 1 1 0 0 0 0
1 1 0 1 1 1 0 0 0 0
1 1 1 0 1 1 0 0 0 0
1 1 1 1 0 1 0 0 0 0
1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0

No. of segments were six, that's why > 6,6 elements are ale zeros


Looks like the facet iteration is not "from one facet to neighboring
facet" ? I assumed, I could record that particular jump from a facet to
other that leads to segment id change , and make those segments as adjacent.

Thanks to check the fallacy in my approach.

--
Sukhraj Singh


--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://sympa.inria.fr/sympa/info/cgal-discuss





--
Sukhraj Singh
 



Archive powered by MHonArc 2.6.18.

Top of Page