Back to index

radiance  4R0+20100331
Functions | Variables
t_func.c File Reference
#include "copyright.h"
#include "ray.h"
#include "func.h"
#include "rtotypes.h"

Go to the source code of this file.

Functions

int t_func (register OBJREC *m, register RAY *r)

Variables

static const char RCSid [] = "$Id: t_func.c,v 2.7 2004/03/30 16:13:01 schorsch Exp $"

Function Documentation

int t_func ( register OBJREC m,
register RAY r 
)

Definition at line 32 of file t_func.c.

{
       FVECT  disp;
       double  d;
       register MFUNC  *mf;
       register int  i;

       if (m->oargs.nsargs < 4)
              objerror(m, USER, "bad # arguments");
       mf = getfunc(m, 3, 0x7, 1);
       setfunc(m, r);
       errno = 0;
       for (i = 0; i < 3; i++) {
              disp[i] = evalue(mf->ep[i]);
              if (errno == EDOM || errno == ERANGE) {
                     objerror(m, WARNING, "compute error");
                     return(0);
              }
       }
       if (mf->f != &unitxf)
              multv3(disp, disp, mf->f->xfm);
       if (r->rox != NULL) {
              multv3(disp, disp, r->rox->f.xfm);
              d = 1.0 / (mf->f->sca * r->rox->f.sca);
       } else
              d = 1.0 / mf->f->sca;
       for (i = 0; i < 3; i++)
              r->pert[i] += disp[i] * d;
       return(0);
}

Here is the call graph for this function:


Variable Documentation

const char RCSid[] = "$Id: t_func.c,v 2.7 2004/03/30 16:13:01 schorsch Exp $" [static]

Definition at line 2 of file t_func.c.