Let me mention that I'm good at C but I don't have much if any C++
experience. I just know the principles.

On Sat, Oct 10, 2009 at 05:14:08PM -0700, grow wrote:
> >
> >         cout << "R11c";fflush (stdout);
> >         if (snake->front().first) {
> >             cout << "R16";fflush (stdout);
> >         // First vertex is moveable. Rotate list so that first vertex is 
> > nonmoveable.
> >             Segment::iterator firstNonmoveableVertex = snake->begin();
> >             while (firstNonmoveableVertex->first) ++firstNonmoveableVertex;
> >
> >             cout << "R17";fflush (stdout);
> >             // Copy initial run on moveable vertices and first nonmoveable 
> > vertex to end of list.
> >             Segment::iterator firstNonmoveablePlusOne = 
> > firstNonmoveableVertex;
> >             ++firstNonmoveablePlusOne;
> >             cout << "R18";fflush (stdout);
> >             snake->insert(snake->end(), snake->begin(), 
> > firstNonmoveablePlusOne);
> >
> >             cout << "R19";fflush (stdout);
> >             // Erase initial run of moveable vertices.
> >             snake->erase(snake->begin(), firstNonmoveableVertex);
> >             cout << "R20";fflush (stdout);
> >         }


Segment is an slist, which seems to be standard C++.

OK. I was fearing a thousand-entry list as 'snake', and having to
step through all that. Not so... When things go wrong: 

the snake is: 
   1<10322,2103> 0<10320,2087> 

So first nonmovable is the second entry. 

So firstNonmoveablePlusOne is snake.end()

and then when trying to insert the part of the list upto-end just
before end().... you end up in an infinite loop. This code doesn't work
if the list is just two entries long.

My C experience tells me that when you code things like this just
right, you shouldn't need, any special cases. However my C++
experience is not good enough to know how to code this so that special
casing is not required.

Anyway, I'll try to create some special-case code for the two element
list that needs to be swapped. 

On the other hand, maybe a snake of only two elements is
nonsensical. I have not studied the code enough to know what it's
doing here. I just traced the code to find where and why it's
crashing. So maybe after adding the code to just swap the two
elements, which it is trying to do, things will crash just a little
bit further on because two element lists is never expected. We'll see.

        Roger. 

-- 
** r.e.wo...@bitwizard.nl ** http://www.BitWizard.nl/ ** +31-15-2600998 **
**    Delftechpark 26 2628 XH  Delft, The Netherlands. KVK: 27239233    **
*-- BitWizard writes Linux device drivers for any device you may have! --*
Q: It doesn't work. A: Look buddy, doesn't work is an ambiguous statement. 
Does it sit on the couch all day? Is it unemployed? Please be specific! 
Define 'it' and what it isn't doing. --------- Adapted from lxrbot FAQ

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"hugin and other free panoramic software" group.
A list of frequently asked questions is available at: 
http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugin-ptx@googlegroups.com
To unsubscribe from this group, send email to 
hugin-ptx+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx
-~----------~----~----~----~------~----~------~--~---

Reply via email to