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


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

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

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


desc
@@


1.3
log
@*** empty log message ***
@
text
@// image_example.05.c   Image composition with point-to-point function

#include <stdlib.h>
#include "UcharDI.h"
#include "FloatCI.h"
#include "BLInterp.h"


// Instances of class rot  represent functions that rotate an
//    IA_Point<double>   through a fixed rotation.
// NOTE: the angle of rotation is defined at instance
//    creation time.  Hence different instances of class  rot
//    may represent different rotation functions.

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);
    }
};


int main()
{
    IA_Image<IA_Point<int>,u_char>
	im1 = read_uchar_PGM("/cis/research/iac++/depot/src/test_image/RCS/sr71.pgm");

    IA_Image<IA_Point<double>,float>
	im2(IA_BLInterp<float>(IA_Image<IA_Point<int>,float>(im1)));


    // Rotate 40 degrees
    IA_Image<IA_Point<double>,float> im3 = IA_Image<IA_Point<double>,float>(
	compose(im2, rot(M_PI*40.0/180))
	);
 
//    IA_Image<IA_Point<double>,float> im4;
//    im4 = IA_Image<IA_Point<double>,float>(
//	compose(im2, rot(M_PI*40.0/180)), 
//	IA_Set<IA_Point<double> > (im3.domain()));

//    if (im4 == im3)
//	cout << "pass";
//    else
//	cout << "fail";

    IA_Image<IA_Point<int>,u_char>
	udi(to_uchar(im3.restrict(im1.domain())));

    cout << udi;

//    display( udi );

    exit( 0 );
}
@


1.2
log
@*** empty log message ***
@
text
@d39 1
a39 1
    im2 = IA_Image<IA_Point<double>,float>(
d43 4
d48 5
d54 1
a54 1
	udi(to_uchar(im2.restrict(im1.domain())));
@


1.1
log
@Initial revision
@
text
@d47 2
@
