i'm confused about the Edge

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

i'm confused about the Edge

Shi Yan
hello guys,

i'm a little confused with the Edge. is there any Edge data structure
that is explicitly implemented in the CGAL?

look at the Polyhedron_items_3 class, there are only vertex, halfedge
and face data structures, but no "Edge"

class Polyhedron_item_3
{

struct Vertex_wrapper{}
struct Halfedge_wrapper{}
struct Face_wrapper{}

}


my problem is i need to add some attribute to the Edge like this:

struct My_edge: public CGAL::HalfedgeDS_halfedge_base<Refs>
{
Color edgeColor;
};


but i'm wondering, if i travel all the edges in this way, and give
each edge a color

typedef Polyhedron::Edge_iterator Edge_iterator;

  Edge_iterator iter=p.edges_begin();
  Edge_iterator iterEnd=p.edges_end();

  for(iter!=iterEnd;++iter)
  {
       (*iter)->edgeColor=CGAL::RED;
  }


then is that true that only half of the half-edges are assigned the color red?

and which half-edge of the two half-edges of an Edge can be visited by
the edge iterator? is there any rule behind?


say if at the beginning i let all the edges in red. and then i split
some random edges of the geometry.
and i assign the all the splitted edge to be in red too.

and now i if i travel all the edges again,


typedef Polyhedron::Edge_iterator Edge_iterator;

  Edge_iterator iter=p.edges_begin();
  Edge_iterator iterEnd=p.edges_end();

  for(iter!=iterEnd;++iter)
  {
       is (*iter)->edgeColor == CGAL::RED;
  }

can i make sure all the edges i traveled are in red?
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: i'm confused about the Edge

Ashwin Nanjappa-2
Bill Conan wrote:
> i'm a little confused with the Edge. is there any Edge data structure
> that is explicitly implemented in the CGAL?

No.

> my problem is i need to add some attribute to the Edge like this:
[...]
> but i'm wondering, if i travel all the edges in this way, and give
> each edge a color
[...]
> then is that true that only half of the half-edges are assigned the color red?

Yes.

> and which half-edge of the two half-edges of an Edge can be visited by
> the edge iterator? is there any rule behind?

If the half edges are {0, 1, 2, 3, 4, 5}, the edge iterator visits {0, 2,
4}. The edge iterator and the half edge iterator access the same half edge
data structure. The edge iterator just skips 2 items instead of 1 when you
  apply the ++ operator to it.

> say if at the beginning i let all the edges in red. and then i split
> some random edges of the geometry.
> and i assign the all the splitted edge to be in red too.
>
> and now i if i travel all the edges again,
[...]
> can i make sure all the edges i traveled are in red?

I couldn't understand your query.

~ash

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