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: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] Finding adjacent segments from SDF Mesh Segmentation
  • Date: Fri, 24 Jun 2016 17:32:46 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=Pass ; spf=None
  • Ironport-phdr: 9a23:yrWoVBat9u55O/3D6sPxueT/LSx+4OfEezUN459isYplN5qZpcmybnLW6fgltlLVR4KTs6sC0LuO9fiwEjxdqb+681k6OKRWUBEEjchE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i760zceF13FOBZvIaytQ8iJ3pzxj7D5q8CbSj4LrQL1Wal1IhSyoFeZnegtqqwmFJwMzADUqGBDYeVcyDAgD1uSmxHh+pX4p8Y7oGwD884mosVPWKG/c6UjRqFDFxwnNXo07Yvlr0rtVwyKszEnX28fiQZJDg6NyBbgX5Dt+mvVu+141TWALOP/RqwzQyXjpe8/UxvvkiYAK3g89EnYj8VxiORQpxf39E83+JLdfIzAbKk2RajaZ95PHWc=
  • Organization: GeometryFactory

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




Archive powered by MHonArc 2.6.18.

Top of Page