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


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

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


desc
@test of magnification, rotation and the IDM.

@


1.2
log
@int main & exit(0)
@
text
@// Emacs -*- C++ -*-
static char test113_rcsid[] = "$Id: test113.c,v 1.1 1994/02/18 18:59:36 thoth Exp monica $";

//
// Read an IAA file, magnify and rotate it and
// display the results using the IDM
//

//
// $Log: test113.c,v $
//Revision 1.1  1994/02/18  18:59:36  thoth
//Initial revision
//

#include <iostream.h>

#include "Image.h"
#include "IntDI.h"
#include "UcharDI.h"
#include "FloatDI.h"
#include "OtherI.h"
#include "../test_image/BLinterp.h"

IA_FloatPoint triple(const IA_FloatPoint &p)
{
    return p/3.0;
}

class rot : public IA_Closure<IA_FloatPoint, IA_FloatPoint> {
    const double	S,C;
  public:
    rot(double	theta)
    :S(sin(theta)), C(cos(theta)) { }
    IA_Closure<IA_FloatPoint, IA_FloatPoint>* clone_self() const {
	return new rot(*this);
    }
    IA_FloatPoint operator()(const IA_FloatPoint &p) const {
	return IA_FloatPoint(p[0]*C + p[1]*S, p[1]*C-p[0]*S);
    }
};

int main(int argc, char ** argv)
{
    char	*disp=getenv("DISPLAY");
    if (disp==0) {
	cerr << "No DISPLAY environment variable, hasta.\n";
	exit(1);
    }

    IDP::ClientID	cid;
    cid = IDP::NewClient("iac++ test013");

    IDP::LinkID		lid;
    lid = IDP::CreateDisplay(cid, disp, IDP::READ_WRITE);

    IA_UcharDiscreteImage	sr71;
    if (argc==3) {
	sr71 = sr71.read_IAA(argv[1], argv[2]);
    } else if (argc==2) {
	sr71 = sr71.read_IAA(argv[1]);
    } else {
	cerr << "Usage: "<<argv[0]<<" iaafile\n";
	exit(1);
    }
#if 1
    sr71
#else
    IA_UcharDiscreteImage(to_uchar(sr71))
#endif
	.IDM_display(lid, "original");

//
//

    lid = IDP::CreateDisplay(cid, disp, IDP::READ_WRITE);

    IA_ContinuousImage<float> sr71i(IA_BLInterp<float>(IA_FloatDiscreteImage(sr71)));
    
    sr71i = compose(sr71i, triple);
    sr71i = compose(sr71i, rot(20.0/180*M_PI));
    
    IA_UcharDiscreteImage	udi(to_uchar(sr71i.restrict(IA_IntPointSet(IA_IntPoint(0,0), 3*IA_IntPoint(63,63)))));

    udi.IDM_display(lid, "scaled and rotated");

    // udi.write_PGM(cout);

    exit(0);
}
@


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