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


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

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


desc
@magnify and rotate an image.
@


1.2
log
@updating to new library conventions.
@
text
@// Emacs: -*- C++ -*-
static char test111_rcsid[] = "$Id: test111.c,v 1.1 1994/02/18 18:58:33 thoth Exp thoth $";

//
// magnify and rotate an image
//

//
// $Log: test111.c,v $
// Revision 1.1  1994/02/18  18:58:33  thoth
// Initial revision
//

#include <math.h>

#include "IntDI.h"
#include "DblPoint.h"

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

const double	mag=3;

const double	rfact = 50.0/180*M_PI;
const double	srf = sin(rfact);
const double	crf = cos(rfact);
IA_Point<int> rot50(const IA_Point<int>&p)
{
  return nint(IA_Point<double>(p[0]*crf+p[1]*srf, -p[0]*srf+p[1]*crf)/mag);
}

int main()
{
  IntDI	im(IntDI::read_PGM(cin));

  int	len = (int)(im.domain().sup().enorm()/2);

  im = im.translate(im.domain().sup()/-2);

  IA_Point<int>	bound = nint(mag*extend_to_point(len, im.domain().dim()));
  im = compose(im, rot50).restrict(IA_Set<IA_Point<int> >(-bound, bound));

  im.write_PGM(cout);
}
@


1.1
log
@Initial revision
@
text
@d2 1
a2 1
static char test111_rcsid[] = "$Id: test105.c,v 1.1 93/03/10 13:57:00 thoth Exp $";
d9 4
a12 1
// $Log:	test105.c,v $
d17 1
a17 1
#include "FloatPoint.h"
d19 1
a19 1
typedef IA_IntDiscreteImage	IntDI;
d26 1
a26 1
IA_IntPoint rot50(const IA_IntPoint&p)
d28 1
a28 1
  return nint(IA_FloatPoint(p[0]*crf+p[1]*srf, -p[0]*srf+p[1]*crf)/mag);
d37 1
a37 1
  im = im.translated(im.domain().sup()/-2);
d39 2
a40 2
  IA_IntPoint	bound = nint(mag*extend_to_point(len, im.domain().dim()));
  im = compose(im, rot50).restrict(IA_IntPointSet(-bound, bound));
@
