Back to index

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

Go to the source code of this file.

Functions

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

Variables

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

Function Documentation

int t_data ( register OBJREC m,
RAY r 
)

Definition at line 34 of file t_data.c.

{
       int  nv;
       FVECT  disp;
       double  dval[3], pt[MAXDIM];
       double  d;
       DATARRAY  *dp;
       register MFUNC  *mf;
       register int  i;

       if (m->oargs.nsargs < 8)
              objerror(m, USER, "bad # arguments");
       dp = getdata(m->oargs.sarg[3]);
       i = (1 << (nv = dp->nd)) - 1;
       mf = getfunc(m, 6, i<<7, 1);
       setfunc(m, r);
       errno = 0;
       for (i = 0; i < nv; i++)
              pt[i] = evalue(mf->ep[i]);
       if (errno == EDOM || errno == ERANGE)
              goto computerr;
       dval[0] = datavalue(dp, pt);
       for (i = 1; i < 3; i++) {
              dp = getdata(m->oargs.sarg[i+3]);
              if (dp->nd != nv)
                     objerror(m, USER, "dimension error");
              dval[i] = datavalue(dp, pt);
       }
       errno = 0;
       for (i = 0; i < 3; i++)
              disp[i] = funvalue(m->oargs.sarg[i], 3, dval);
       if (errno == EDOM || errno == ERANGE)
              goto computerr;
       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);
computerr:
       objerror(m, WARNING, "compute error");
       return(0);
}

Here is the call graph for this function:


Variable Documentation

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

Definition at line 2 of file t_data.c.