| 1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
| 2 |
– |
|
| 1 |
|
#ifndef lint |
| 2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
| 2 |
> |
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 6 |
– |
|
| 4 |
|
/* |
| 5 |
|
* mx_data.c - routine for stored mixtures. |
| 9 |
– |
* |
| 10 |
– |
* 11/2/88 |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
< |
#include "ray.h" |
| 8 |
> |
#include "copyright.h" |
| 9 |
|
|
| 10 |
+ |
#include "ray.h" |
| 11 |
|
#include "data.h" |
| 16 |
– |
|
| 12 |
|
#include "func.h" |
| 13 |
+ |
#include "rtotypes.h" |
| 14 |
|
|
| 15 |
|
/* |
| 16 |
|
* A stored mixture is specified: |
| 41 |
|
*/ |
| 42 |
|
|
| 43 |
|
|
| 44 |
< |
mx_data(m, r) /* interpolate mixture data */ |
| 45 |
< |
register OBJREC *m; |
| 46 |
< |
RAY *r; |
| 44 |
> |
int |
| 45 |
> |
mx_data( /* interpolate mixture data */ |
| 46 |
> |
OBJREC *m, |
| 47 |
> |
RAY *r |
| 48 |
> |
) |
| 49 |
|
{ |
| 50 |
|
OBJECT obj; |
| 51 |
|
double coef; |
| 52 |
< |
double pt[MAXDIM]; |
| 52 |
> |
double pt[MAXDDIM]; |
| 53 |
|
DATARRAY *dp; |
| 54 |
|
OBJECT mod[2]; |
| 55 |
< |
register MFUNC *mf; |
| 56 |
< |
register int i; |
| 55 |
> |
MFUNC *mf; |
| 56 |
> |
int i; |
| 57 |
|
|
| 58 |
|
if (m->oargs.nsargs < 6) |
| 59 |
|
objerror(m, USER, "bad # arguments"); |
| 73 |
|
errno = 0; |
| 74 |
|
for (i = 0; i < dp->nd; i++) { |
| 75 |
|
pt[i] = evalue(mf->ep[i]); |
| 76 |
< |
if (errno) |
| 76 |
> |
if ((errno == EDOM) | (errno == ERANGE)) |
| 77 |
|
goto computerr; |
| 78 |
|
} |
| 79 |
|
coef = datavalue(dp, pt); |
| 80 |
|
errno = 0; |
| 81 |
|
coef = funvalue(m->oargs.sarg[2], 1, &coef); |
| 82 |
< |
if (errno) |
| 82 |
> |
if ((errno == EDOM) | (errno == ERANGE)) |
| 83 |
|
goto computerr; |
| 84 |
|
if (raymixture(r, mod[0], mod[1], coef)) { |
| 85 |
|
if (m->omod != OVOID) |
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
|
| 96 |
< |
mx_pdata(m, r) /* interpolate mixture picture */ |
| 97 |
< |
register OBJREC *m; |
| 98 |
< |
RAY *r; |
| 96 |
> |
int |
| 97 |
> |
mx_pdata( /* interpolate mixture picture */ |
| 98 |
> |
OBJREC *m, |
| 99 |
> |
RAY *r |
| 100 |
> |
) |
| 101 |
|
{ |
| 102 |
|
OBJECT obj; |
| 103 |
|
double col[3], coef; |
| 104 |
< |
double pt[MAXDIM]; |
| 104 |
> |
double pt[MAXDDIM]; |
| 105 |
|
DATARRAY *dp; |
| 106 |
|
OBJECT mod[2]; |
| 107 |
< |
register MFUNC *mf; |
| 108 |
< |
register int i; |
| 107 |
> |
MFUNC *mf; |
| 108 |
> |
int i; |
| 109 |
|
|
| 110 |
|
if (m->oargs.nsargs < 7) |
| 111 |
|
objerror(m, USER, "bad # arguments"); |
| 124 |
|
errno = 0; |
| 125 |
|
pt[1] = evalue(mf->ep[0]); /* y major ordering */ |
| 126 |
|
pt[0] = evalue(mf->ep[1]); |
| 127 |
< |
if (errno) |
| 127 |
> |
if ((errno == EDOM) | (errno == ERANGE)) |
| 128 |
|
goto computerr; |
| 129 |
|
for (i = 0; i < 3; i++) /* get pixel from picture */ |
| 130 |
|
col[i] = datavalue(dp+i, pt); |
| 131 |
|
errno = 0; /* evaluate function on pixel */ |
| 132 |
|
coef = funvalue(m->oargs.sarg[2], 3, col); |
| 133 |
< |
if (errno) |
| 133 |
> |
if ((errno == EDOM) | (errno == ERANGE)) |
| 134 |
|
goto computerr; |
| 135 |
|
if (raymixture(r, mod[0], mod[1], coef)) { |
| 136 |
|
if (m->omod != OVOID) |