head	1.1;
access
	monica
	thoth;
symbols;
locks
	monica:1.1; strict;
comment	@// @;


1.1
date	94.10.25.21.45.31;	author monica;	state Exp;
branches;
next	;


desc
@@


1.1
log
@Initial revision
@
text
@// Emacs -*- C++ -*-
static char test112_rcsid[] = "$Id: test112.c,v 1.2 1994/08/24 00:30:59 monica Exp monica $";

//
// magnify and rotate an image
//

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

#include <iostream.h>

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

#if 0
class ramp: public IA_OtherCI<int> {
  public:
    ramp(IA_FloatPointSet ps) :IA_OtherCI<int>(ps) { }
    int operator()(const IA_FloatPoint &fp) const {
	return (int) fp[0];
    }
    IA_OtherCI<int> * clone_self() const { return new ramp(*this); }
};

IA_ContinuousImage<int>	barf(ramp(IA_CWhiteHole(2)));
#endif

IA_Point<double>  triple(const IA_Point<double>  &p)
{
    return p/3.0;
}
#if 1
class rot : public IA_Closure<IA_Point<double> , IA_Point<double> > {
    const double	S,C;
  public:
    rot(double	theta)
    :S(sin(theta)), C(cos(theta)) { }
    IA_Closure<IA_Point<double> , IA_Point<double> >* clone_self() const {
	return new rot(*this);
    }
    IA_Point<double>  operator()(const IA_Point<double>  &p) const {
	return IA_Point<double> (p[0]*C + p[1]*S, p[1]*C-p[0]*S);
    }
};
#else
const double	rfact = 20.0/180*M_PI;
const double	srf = sin(rfact);
const double	crf = cos(rfact);
IA_Point<double>  rot20(const IA_Point<double>  &p)
{
  return IA_Point<double> (p[0]*crf+p[1]*srf, -p[0]*srf+p[1]*crf);
}
#endif
int main()
{
    IA_Image<IA_Point<int>, float>	sr71(IA_Image<IA_Point<int>, int>::read_PGM("/cis/research/iac++/depot/src/test_image/RCS/sr71.pgm"));
    IA_Image<IA_Point<double>,float> sr71i(IA_BLInterp<float>(sr71));
    
    sr71i = compose(sr71i, triple);
#if 1
    sr71i = compose(sr71i, rot(20.0/180*M_PI));
#else
    sr71i = compose(sr71i, rot20);
#endif
    
    IA_Image<IA_Point<int>, u_char>	udi(to_uchar(sr71i.restrict(IA_Set<IA_Point<int> >(IA_Point<int>(0,0), 3*IA_Point<int>(63,63)))));

    udi.write_PGM(cout);

    exit(0);
}
@
