From: Abdo Haji-Ali on
How can you order a list of connected edges to get a specific order
(CCW or CW)?
Right now I'm reversing the edge order to get a desired order.

For example:
If these edges are ordered CW: A-B, B-C, C-D, D-A
and I want them CCW, I reverse them like this: A-D, D-C, C-B, B-A

My question is: is this algorithm correct in all cases? Is there a
faster algorithm?
Thanks,
Abdo Haji-Ali
Programmer
In|Framez
From: Abdo Haji-Ali on
I'm really sorry. Wrong newsgroup (I meant this message for
graphics.algorithm).
Please ignore this message.

Sorry again,
Abdo Haji-Ali
Programmer
In|Framez

On Apr 21, 11:50 am, Abdo Haji-Ali <abdo.haji....(a)gmail.com> wrote:
> How can you order a list of connected edges to get a specific order
> (CCW or CW)?
> Right now I'm reversing the edge order to get a desired order.
>
> For example:
> If these edges are ordered CW: A-B, B-C, C-D, D-A
> and I want them CCW, I reverse them like this: A-D, D-C, C-B, B-A
>
> My question is: is this algorithm correct in all cases? Is there a
> faster algorithm?
> Thanks,
> Abdo Haji-Ali
> Programmer
> In|Framez
From: Ulrich Eckhardt on
Abdo Haji-Ali wrote:
> How can you order a list of connected edges to get a specific order
> (CCW or CW)? Right now I'm reversing the edge order to get a desired
> order.
>
> For example:
> If these edges are ordered CW: A-B, B-C, C-D, D-A
> and I want them CCW, I reverse them like this: A-D, D-C, C-B, B-A
>
> My question is: is this algorithm correct in all cases? Is there a
> faster algorithm?

I have no idea what this has to do with the typical topic of this NG, but
I'd consider using either reverse_iterator or maybe use Boost's iterator
builder library, which is probably faster than sorting or reversing
anything.

However, the standard answer on performance questions still applies: profile
first, optimise later.

Uli

--
C++ FAQ: http://parashift.com/c++-faq-lite

Sator Laser GmbH
Geschäftsführer: Michael Wöhrmann, Amtsgericht Hamburg HR B62 932