How to find the adjacent faces of every edge?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to find the adjacent faces of every edge?

sergio
This post was updated on .
I have the following loop iterator:

void printAdjancenFaceToEdge(Polyhedron mesh)
{
    std::vector<int> nBorder(mesh.size_of_vertices(), 0);
    for (Polyhedron::Halfedge_const_iterator he = mesh.halfedges_begin(); he
!= mesh.halfedges_end(); he++) {
        if (!he->is_border())
            continue;

        // print here ids  
    }

}
is it possible to print the adjacent faces index of every edge?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: How to find the adjacent faces of every edge?

Sebastien Loriot (GeometryFactory)
If you have a index associated to faces, then from a halfedge you can
access the faces using

halfedge_descriptor h;
face_descriptor f1 = face(h, mesh);
halfedge_descriptor h_opp = opposite(h, mesh);
if (!CGAL::is_border(h_opp, mesh))
   face_descriptor f2 = face(h_opp, mesh);


with halfedge_descriptor and face_descriptor being nested types of
boost::graph_traits<Mesh_type>

To associate an id to a face, you can use internal property (built-in
with Surface_mesh or with a traits with ids like
CGAL::Polyhedron_items_with_id_3 [1]). In general you can also use
dynamic properties [2]


Sebastien.

[1]
https://doc.cgal.org/latest/BGL/classCGAL_1_1Polyhedron__items__with__id__3.html
[2] https://doc.cgal.org/latest/BGL/index.html#title25

On 06/22/2018 10:48 AM, sergio wrote:

> I have the following loop iterator:
>
> void printAdjancenFaceToEdge(Polyhedron mesh)
> {
>      std::vector<int> nBorder(mesh.size_of_vertices(), 0);
>      for (Polyhedron::Halfedge_const_iterator he = mesh.halfedges_begin(); he
> != mesh.halfedges_end(); he++) {
>          if (!he->is_border())
>              continue;
>
>          // print here ids
>      }
>
>
>      return true;
> }
> is it possible to print the adjacent faces index of every edge?
>
>
>
> --
> Sent from: http://cgal-discuss.949826.n4.nabble.com/
>

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


Reply | Threaded
Open this post in threaded view
|

Re: How to find the adjacent faces of every edge?

Shankar Kulumani
In reply to this post by sergio
I think there's a circulator around the halfedges of each face. Then given a halfedge you can find the opposite face, by calling the opposite/inverse function, then store this face pointer ( since your dealing with the polyhedron mesh)

I'm not on my computer but can find the exact functions once I look at the docs again.


On Fri, Jun 22, 2018, 04:49 sergio <[hidden email]> wrote:
I have the following loop iterator:

void printAdjancenFaceToEdge(Polyhedron mesh)
{
    std::vector<int> nBorder(mesh.size_of_vertices(), 0);
    for (Polyhedron::Halfedge_const_iterator he = mesh.halfedges_begin(); he
!= mesh.halfedges_end(); he++) {
        if (!he->is_border())
            continue;

        // print here ids   
    }


    return true;
}
is it possible to print the adjacent faces index of every edge?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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


Reply | Threaded
Open this post in threaded view
|

Re: How to find the adjacent faces of every edge?

sergio
Ok thanks!

On Fri, Jun 22, 2018 at 11:55 AM, Shankar Kulumani <[hidden email]> wrote:
I think there's a circulator around the halfedges of each face. Then given a halfedge you can find the opposite face, by calling the opposite/inverse function, then store this face pointer ( since your dealing with the polyhedron mesh)

I'm not on my computer but can find the exact functions once I look at the docs again.



On Fri, Jun 22, 2018, 04:49 sergio <[hidden email]> wrote:
I have the following loop iterator:

void printAdjancenFaceToEdge(Polyhedron mesh)
{
    std::vector<int> nBorder(mesh.size_of_vertices(), 0);
    for (Polyhedron::Halfedge_const_iterator he = mesh.halfedges_begin(); he
!= mesh.halfedges_end(); he++) {
        if (!he->is_border())
            continue;

        // print here ids   
    }


    return true;
}
is it possible to print the adjacent faces index of every edge?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/

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



Reply | Threaded
Open this post in threaded view
|

Re: How to find the adjacent faces of every edge?

sergio
In reply to this post by Sebastien Loriot (GeometryFactory)
What happen if the structure has non-manifold edges, it will work?

On Fri, Jun 22, 2018 at 11:35 AM, Sebastien Loriot (GeometryFactory) <[hidden email]> wrote:
If you have a index associated to faces, then from a halfedge you can access the faces using

halfedge_descriptor h;
face_descriptor f1 = face(h, mesh);
halfedge_descriptor h_opp = opposite(h, mesh);
if (!CGAL::is_border(h_opp, mesh))
  face_descriptor f2 = face(h_opp, mesh);


with halfedge_descriptor and face_descriptor being nested types of
boost::graph_traits<Mesh_type>

To associate an id to a face, you can use internal property (built-in
with Surface_mesh or with a traits with ids like CGAL::Polyhedron_items_with_id_3 [1]). In general you can also use
dynamic properties [2]


Sebastien.

[1] https://doc.cgal.org/latest/BGL/classCGAL_1_1Polyhedron__items__with__id__3.html
[2] https://doc.cgal.org/latest/BGL/index.html#title25


On 06/22/2018 10:48 AM, sergio wrote:
I have the following loop iterator:

void printAdjancenFaceToEdge(Polyhedron mesh)
{
     std::vector<int> nBorder(mesh.size_of_vertices(), 0);
     for (Polyhedron::Halfedge_const_iterator he = mesh.halfedges_begin(); he
!= mesh.halfedges_end(); he++) {
         if (!he->is_border())
             continue;

         // print here ids
     }


     return true;
}
is it possible to print the adjacent faces index of every edge?



--
Sent from: http://cgal-discuss.949826.n4.nabble.com/


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



Reply | Threaded
Open this post in threaded view
|

Re: How to find the adjacent faces of every edge?

Sebastien Loriot (GeometryFactory)
You cannot have non-manifold edges in a halfedge data structure by
definition.

You need to use something more general like a linear cell complex for
example if you want to have non-manifold edges.

https://doc.cgal.org/latest/Linear_cell_complex/index.html

Sebastien.

On 06/22/2018 12:24 PM, sergio campo wrote:

> What happen if the structure has non-manifold edges, it will work?
>
> On Fri, Jun 22, 2018 at 11:35 AM, Sebastien Loriot (GeometryFactory)
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>     If you have a index associated to faces, then from a halfedge you
>     can access the faces using
>
>     halfedge_descriptor h;
>     face_descriptor f1 = face(h, mesh);
>     halfedge_descriptor h_opp = opposite(h, mesh);
>     if (!CGAL::is_border(h_opp, mesh))
>        face_descriptor f2 = face(h_opp, mesh);
>
>
>     with halfedge_descriptor and face_descriptor being nested types of
>     boost::graph_traits<Mesh_type>
>
>     To associate an id to a face, you can use internal property (built-in
>     with Surface_mesh or with a traits with ids like
>     CGAL::Polyhedron_items_with_id_3 [1]). In general you can also use
>     dynamic properties [2]
>
>
>     Sebastien.
>
>     [1]
>     https://doc.cgal.org/latest/BGL/classCGAL_1_1Polyhedron__items__with__id__3.html
>     <https://doc.cgal.org/latest/BGL/classCGAL_1_1Polyhedron__items__with__id__3.html>
>     [2] https://doc.cgal.org/latest/BGL/index.html#title25
>     <https://doc.cgal.org/latest/BGL/index.html#title25>
>
>
>     On 06/22/2018 10:48 AM, sergio wrote:
>
>         I have the following loop iterator:
>
>         void printAdjancenFaceToEdge(Polyhedron mesh)
>         {
>               std::vector<int> nBorder(mesh.size_of_vertices(), 0);
>               for (Polyhedron::Halfedge_const_iterator he =
>         mesh.halfedges_begin(); he
>         != mesh.halfedges_end(); he++) {
>                   if (!he->is_border())
>                       continue;
>
>                   // print here ids
>               }
>
>
>               return true;
>         }
>         is it possible to print the adjacent faces index of every edge?
>
>
>
>         --
>         Sent from: http://cgal-discuss.949826.n4.nabble.com/
>         <http://cgal-discuss.949826.n4.nabble.com/>
>
>
>     --
>     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