head	1.9;
access;
symbols
	r2_1:1.7
	r2_0:1.7
	r1_1_beta:1.7
	r1_1_alpha:1.6
	r1_0:1.6
	r0_11:1.6
	r0_10:1.6
	r0_9:1.6
	Eglin_alpha_1:1.5;
locks; strict;
comment	@// @;


1.9
date	94.11.10.19.53.56;	author ljr;	state Exp;
branches;
next	1.8;

1.8
date	94.10.06.17.39.00;	author fjsoria;	state Exp;
branches;
next	1.7;

1.7
date	94.07.25.16.58.52;	author thoth;	state Exp;
branches;
next	1.6;

1.6
date	93.07.15.11.38.59;	author thoth;	state Exp;
branches;
next	1.5;

1.5
date	93.05.28.15.05.24;	author thoth;	state Exp;
branches;
next	1.4;

1.4
date	93.05.26.16.41.05;	author thoth;	state Exp;
branches;
next	1.3;

1.3
date	93.04.16.15.50.14;	author thoth;	state Exp;
branches;
next	1.2;

1.2
date	92.12.16.14.48.00;	author thoth;	state Exp;
branches;
next	1.1;

1.1
date	92.08.23.13.30.00;	author thoth;	state Exp;
branches;
next	;


desc
@CFrontified version
@


1.9
log
@Added IA_NO_RCS_STATIC_DATA guard.
@
text
@// Emacs: -*- C++ -*-

//
//	Copyright 1993, Center for Computer Vision and Visualization,
//	University of Florida.  All rights reserved.
//

#ifndef IA_NO_RCS_STATIC_DATA
static char copyright[] = "Copyright 1993, Center for Computer Vision and Visualization,\nUniversity of Florida.  All rights reserved.\n";

static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.8 1994/10/06 17:39:00 fjsoria Exp ljr $";
#endif

// 
// $Log: BoxyIPSIter.c,v $
// Revision 1.8  1994/10/06  17:39:00  fjsoria
// commented rscid[] line
//
// Revision 1.7  1994/07/25  16:58:52  thoth
// \Name sanitization
//
// Revision 1.6  1993/07/15  11:38:59  thoth
// new BasePSIter implementation.
//
// Revision 1.5  93/05/28  15:05:24  thoth
// removed dependency on with-ia-pointset*
// 
// Revision 1.4  93/05/26  16:41:05  thoth
// Copyright Notices.
// 
// Revision 1.3  93/04/16  15:50:14  thoth
// use IA_IntPoint instead of IntPoint.
// 
// Revision 1.2  92/12/16  14:48:00  thoth
// conversion to IA_ mostly complete
// 
// Revision 1.1  92/08/23  13:30:00  thoth
// Initial revision
// 
// 

#include "BoxyIPSIter.h"

#ifdef IA_PRII
#pragma implementation
#endif

IA_BoxyIPSIter::IA_BoxyIPSIter(IA_BoxyIPS *b)
: IA_BasePSIter<IA_Point<int> >(b),
  curr(b->start)
{
}

IA_BoxyIPSIter::IA_BoxyIPSIter(const IA_BoxyIPSIter &x)
: IA_BasePSIter<IA_Point<int> >(x.domain),
  curr(x.curr)
{
}

int IA_BoxyIPSIter::next(IA_Point<int>& ip)
{
    // This only happens if the previous call to next caused
    // curr to carry past its beginning (which means we ran out of points).
    if (this->curr[0] > box()->end[0])
	return 0;

    // prepare the parameter for when we return;
    ip = this->curr;

    // increment curr to the lexicographically next point in the point set.
    unsigned i = box()->dimen - 1;
    while (1) {
	if (++this->curr[i] > box()->end[i] && i!=0) {
	    // We have overflowed the current "digit".
	    // Reset this digit and allow the loop to run around for
	    // the carry.
	    this->curr[i] = box()->start[i];
	} else {
	    // Either there is no overflow or we have run out of digits to
	    // carry into.  We can provide the user with a point in any case.

	    break;

	    // on the next call to the next() method, an overflow will
	    // be detected.
	}
	// There was an overflow.  We will loop again using the next
	// higher significant digit.
	i--;
    }

    // Whatever happened during the increment operation doesn't matter here.
    // we knew we had a value to return when we realized curr was in bounds.
    // If the increment operation totally overflowed, then the next call
    // to next() will be unable to provide a point and the test at the
    // beginning will handle it appropriately.
    return 1;
}
@


1.8
log
@commented rscid[] line
@
text
@d8 2
a9 1
//static char copyright[] = "Copyright 1993, Center for Computer Vision and Visualization,\nUniversity of Florida.  All rights reserved.\n";
d11 2
a12 1
//static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.7 1994/07/25 16:58:52 thoth Exp fjsoria $";
d16 3
@


1.7
log
@\Name sanitization
@
text
@d8 1
a8 1
static char copyright[] = "Copyright 1993, Center for Computer Vision and Visualization,\nUniversity of Florida.  All rights reserved.\n";
d10 1
a10 1
static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.6 1993/07/15 11:38:59 thoth Exp thoth $";
d14 3
@


1.6
log
@new BasePSIter implementation.
@
text
@d10 1
a10 1
static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.5 93/05/28 15:05:24 thoth Exp Locker: thoth $";
d13 4
a16 1
// $Log:	BoxyIPSIter.c,v $
d41 1
a41 1
: IA_BaseIPSIter(b),
d47 1
a47 1
: IA_BaseIPSIter(x.domain),
d52 1
a52 1
int IA_BoxyIPSIter::next(IA_IntPoint& ip)
@


1.5
log
@removed dependency on with-ia-pointset*
@
text
@d10 1
a10 1
static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.4 93/05/26 16:41:05 thoth Exp Locker: thoth $";
d14 3
d37 2
a38 2
IA_BoxyIPSIter::IA_BoxyIPSIter(const IA_IntPointSet& x, IA_BoxyIPS *b)
: IA_BaseIPSIter(x),
a40 1
    box = b;
a46 1
    box = x.box;
d53 1
a53 1
    if (this->curr[0] > box->end[0])
d60 1
a60 1
    unsigned i = box->dimen - 1;
d62 1
a62 1
	if (++this->curr[i] > box->end[i] && i!=0) {
d66 1
a66 1
	    this->curr[i] = box->start[i];
@


1.4
log
@Copyright Notices.
@
text
@d10 1
a10 1
static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.3 93/04/16 15:50:14 thoth Exp Locker: thoth $";
d14 3
d34 2
a35 4
#include "with-ia-pointset-P.h"

BoxyIPSIter::IA_BoxyIPSIter(const IntPointSet& x, BoxyIPS *b)
: BaseIPSIter(x),
d41 2
a42 2
BoxyIPSIter::IA_BoxyIPSIter(const BoxyIPSIter &x)
: BaseIPSIter(x.domain),
d48 1
a48 1
int BoxyIPSIter::next(IA_IntPoint& ip)
@


1.3
log
@use IA_IntPoint instead of IntPoint.
@
text
@a1 1
static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.2 92/12/16 14:48:00 thoth Exp Locker: thoth $";
d3 9
d14 3
@


1.2
log
@conversion to IA_ mostly complete
@
text
@d2 1
a2 1
static char rcsid[] = "$Id: BoxyIPSIter.c,v 1.1 92/08/23 13:30:00 thoth Exp Locker: thoth $";
d6 3
d36 1
a36 1
int BoxyIPSIter::next(IntPoint& ip)
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
static char rcsid[] = "$Id: BoxyIPSIter.cc,v 1.4 92/08/14 15:48:01 thoth Exp $";
d5 3
a7 1
// $Log:	BoxyIPSIter.cc,v $
d9 1
d17 3
a19 1
BoxyIPSIter::BoxyIPSIter(const IntPointSet& x, BoxyIPS *b)
d26 1
a26 1
BoxyIPSIter::BoxyIPSIter(const BoxyIPSIter &x)
@
