## NAME

         rotate - rotates an image

## SYNOPSIS

          #include "CVIPtoolkit.h"
          #include "CVIPgeometry.h"

         Image *rotate( Image *input_Image, float degree)

          <input> - a pointer to an Image structure
          <degree> - amount to rotate image (1 - 360)

## PATH

         $CVIPHOME/GEOMETRY/rotate.c

## DESCRIPTION

          This function rotates the image by the degree specified.The
         transformation           equation          used          are
              X=xcos(rads)+ysin(rads);      Y=-xsin(rads)+ycos(rads);
          where      X=shifted x  co-ordinate       Y=shifted  y  co-
         ordinate      rads=number of radians to be rotated
          For the 4 corners of the image,the shifted co-ordinates
          are  found out and from that the new image size can be
          calculated .For each co-ordinate in the new image the
          corresponding  co-ordinate in the old image is calculated,
          if it  falls with in the range of the old image size,
          the corresponding pixel  value is copied,otherwise
          the pixel value is  set to zero.

## TYPES AND CONSTANTS

         #define pi 3.141592

## RETURN VALUES

          Pointer to the rotated image

## HISTORY

          History information copied from the old to the new
          image

## EXAMPLE

          #include <CVIPtoolkit.h>
          #include <CVIPimage.h>
          #include <CVIPdef.h>
          #include <CVIPgeometry.h>
          #include <CVIPconvert.h>
          #include <CVIPview.h>
          #define VIEWER "picture"
          #define VIDEO_APP "SunVideo &"
          void main()
          {
          Image *cvipImage;
          IMAGE_FORMAT format;
          char *inputfile,*outputfile;

          setDisplay_Image(VIEWER, "Default");

          print_CVIP("\n\t\tEnter the  Input File Name:  ");
          inputfile =(char *) getString_CVIP();
          format = getFormat_CVIP(inputfile);
          cvipImage = read_Image(inputfile, 1);
          view_Image(cvipImage, inputfile);
          free(inputfile);
          /*the following call rotates the image by 90
          degrees */
          cvipImage = rotate(cvipImage,90);
          print_CVIP("\n\t\tEnter the Output File Name:  ");
          outputfile = getString_CVIP();
          view_Image(cvipImage,outputfile);
          write_Image(cvipImage,outputfile,CVIP_NO,CVIP_NO,format,1);
          free(outputfile);
          }

## SEE ALSO

         libgeometry

## AUTHOR

         Copyright (C) 1996 SIUE - by Scott E. Umbaugh and
          Sreenivas Makam.