Main Page   Data Structures   File List   Data Fields   Globals  

sinestar.c

Go to the documentation of this file.
00001 #include        "sadie.h"
00002 
00003 /*-Copyright Information------------------------------------------------------*/
00004 /* Copyright (c) 1993 by the University of Arizona Digital Image Analysis Lab */
00005 /*----------------------------------------------------------------------------*/
00006 /*-General Information--------------------------------------------------------*/
00007 /*                                                                            */
00008 /*   This function creates a sine star test pattern.                          */
00009 /*                                                                            */
00010 /*----------------------------------------------------------------------------*/
00011 /*-Interface Information------------------------------------------------------*/
00012 void SINESTAR (
00013 short  nlin,    /*  I   Number of lines in the output image.                  */
00014 short  npix,    /*  I   Number of pixels/line in the output image.            */
00015 double period,  /*  I   Number of sine periods.                               */
00016 IMAGE  **out    /*  O   Address of a pointer to the output image.             */
00017 /*----------------------------------------------------------------------------*/
00018 ) { register short j, k;
00019     char   msg[SLEN];
00020     double x, y, angle;
00021 
00022     if (TIMES) TIMING(T_SINESTAR);
00023     if (NAMES) {
00024         MESSAGE('I',"");
00025         MESSAGE('I',"SINESTAR");
00026         MESSAGE('I',"");
00027         sprintf(msg," Image size: lines:           %d",nlin);
00028         MESSAGE('I',msg);
00029         sprintf(msg,"             pixels:          %d",npix);
00030         MESSAGE('I',msg);
00031         sprintf(msg," Period(s):                 %12.4e",period);
00032         MESSAGE('I',msg);
00033         MESSAGE('I'," ...............");
00034     }
00035 
00036     /* create image of appropriate size */
00037     if (!CHECKIMG(*out)) GETMEM(1,nlin,npix,out);
00038 
00039     /* create sine star test pattern */
00040     for (j=0; j<nlin; j++) {
00041         y = (double)(j-nlin/2);
00042         for (k=0; k<npix; k++) {
00043             x = (double)(k-npix/2);
00044             if (x == 0.0) {
00045                 if (y > 0.0) {
00046                     angle =  PI / 2.0;
00047                 } else if (y < 0.0) {
00048                     angle = -PI / 2.0;
00049                 } else {
00050                     angle = 0.0;
00051                 }
00052             } else {
00053                 angle = atan2(y,x);
00054             }
00055             (*out)->data[0][j][k] = (PIXEL)cos(angle*period);
00056         }
00057     }
00058 
00059     the_end:
00060     if (TIMES) TIMING(T_EXIT);
00061 }

Generated on Wed Apr 9 08:56:14 2003 for TREES by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002