head	1.3;
access
	monica
	thoth;
symbols;
locks; strict;
comment	@// @;


1.3
date	94.10.26.00.10.54;	author monica;	state Exp;
branches;
next	1.2;

1.2
date	94.08.24.00.30.59;	author monica;	state Exp;
branches;
next	1.1;

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


desc
@test of translation method.
@


1.3
log
@updated types
@
text
@// Emacs: -*- C++ -*-
static char test108_rcsid[] = "$Id: test108.c,v 1.2 1994/08/24 00:30:59 monica Exp monica $";

// test of translation method

//
// $Log: test108.c,v $
// Revision 1.2  1994/08/24  00:30:59  monica
// int main & exit(0)
//
//Revision 1.1  1994/02/18  18:46:07  thoth
//Initial revision
//

#include "IntDI.h"
#include "ImageIter.h"
#include "test-ops.h"

typedef IA_Image<IA_Point<int>,int>	IntDI;

double	density=0.5;

int bullshit(const IA_Point<int>  &) {
    return drand48()<density;
}

int main()
{
    IA_Set<IA_Point<int> >	ps(IA_Point<int> (0,0), IA_Point<int> (63,63));
    IA_Set<IA_Point<int> >	ps2(IA_Point<int> (-20,-20), IA_Point<int> (70,70));
    IA_Set<IA_Point<int> >	mess(2, bullshit);
    IA_Set<IA_Point<int> >	temp;
    IntDI	vi1(IntDI(RandomDI<int>(ps,-200,200)).restrict(ps));
    IntDI	vi2;
    IA_Point<int> 	off(5,-20);

    temp = ps2&mess;
    vi1 = vi1.restrict(temp);
//    vi2 = vi1.translated(off);

    IA_IPIter<IA_Point<int> ,int>	iter1(vi1), iter2(vi2);
    IA_Point<int> 	p1, p2;
    int		v1,v2;

    if (vi1.domain()+off != vi2.domain()) {
	cout << "translated domain incorrect\n";
    }

    while (1) {
      int	t1=iter1(p1,v1),t2=iter2(p2,v2);
      if (t1!=t2) {
	cout << "finishing out of sync\n";
	exit(1);
      }
      if (!t1)
	  break;

      if (p1+off != p2) {
	cout << "point sync error\n";
      }
      if (v1 != v2)
	cout << "value error\n";
    }

    cout << "test succeeded\n";
    exit(0);
}
@


1.2
log
@int main & exit(0)
@
text
@d2 1
a2 1
static char test108_rcsid[] = "$Id: test108.c,v 1.1 1994/02/18 18:46:07 thoth Exp monica $";
d8 3
d19 1
a19 1
typedef IA_IntDiscreteImage	IntDI;
d23 1
a23 1
int bullshit(const IA_IntPoint &) {
d29 5
a33 5
    IA_IntPointSet	ps(IA_IntPoint(0,0), IA_IntPoint(63,63));
    IA_IntPointSet	ps2(IA_IntPoint(-20,-20), IA_IntPoint(70,70));
    IA_IntPointSet	mess(2, bullshit);
    IA_IntPointSet	temp;
    IntDI	vi1(IA_IntDiscreteImage(RandomDI<int>(ps,-200,200)).restrict(ps));
d35 1
a35 1
    IA_IntPoint	off(5,-20);
d39 1
a39 1
    vi2 = vi1.translated(off);
d41 2
a42 2
    IA_IPIter<IA_IntPoint,int>	iter1(vi1), iter2(vi2);
    IA_IntPoint	p1, p2;
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
static char test108_rcsid[] = "$Id: test105.c,v 1.1 93/03/10 13:57:00 thoth Exp $";
d7 4
a10 1
// $Log:	test105.c,v $
@
