ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/tabfunc.c
(Generate patch)

Comparing ray/src/cal/tabfunc.c (file contents):
Revision 1.6 by greg, Sat Nov 12 06:14:51 2005 UTC vs.
Revision 1.11 by greg, Wed Feb 28 03:17:23 2024 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7   *      2/2/95  Greg Ward
8   */
9  
10 #include <stdio.h>
10   #include <stdlib.h>
12 #include <string.h>
11   #include <math.h>
12   #include <ctype.h>
15 #include <sys/types.h>
13  
14   #include "rtprocess.h" /* getpid() */
15   #include "rtmath.h"
# Line 20 | Line 17 | static const char      RCSid[] = "$Id$";
17  
18   #define  isdelim(c)     (isspace(c) || (c)==',')
19  
20 < #define  MAXTAB         1024            /* maximum number of data rows */
21 < #define  MAXLINE        4096            /* maximum line width (characters) */
20 > #define  MAXTAB         8192            /* maximum number of data rows */
21 > #define  MAXLINE        16384           /* maximum line width (characters) */
22   #define  OUTFMT         "%.7g"          /* output format conversion string */
23  
24   int     interpolate = 0;
# Line 109 | Line 106 | FILE   *fp
106                                  goto fatal;
107                          }
108                          ordinate[i][tabsize] = atof(cp);
109 <                        if ((cp = fskip(cp)) == NULL) {
109 >                        if ((cp = fskip(cp)) == NULL || !isdelim(*cp)) {
110                                  err = "bad floating-point format";
111                                  goto fatal;
112                          }
# Line 159 | Line 156 | absc_exp(void)                 /* produce expression for abscissa */
156                  printf("X`%s(i):select(i,", locID);
157                  putlist(abscissa, tabsize, 20);
158                  puts(");");
159 <                if (increasing) {
159 >                if (increasing)
160 >                        printf("fx2`%s(x,i):if(x-X`%s(i),\n", locID, locID);
161 >                else
162 >                        printf("fx2`%s(x,i):if(X`%s(i)-x,\n", locID, locID);
163 >                printf("\ti+(x-X`%s(i))/(X`%s(i+1)-X`%s(i)),\n",
164 >                                locID, locID, locID);
165 >                printf("\tfx2`%s(x,i-1));\n", locID);
166 >                if (increasing)
167                          printf("fx`%s(x):if(x-%g,if(%g-x,fx2`%s(x,%d),%d),1);\n",
168                                          locID, abscissa[0], abscissa[tabsize-1],
169                                          locID, tabsize, tabsize);
170 <                        printf("fx2`%s(x,i):if(x-X`%s(i),\n", locID, locID);
167 <                } else {
170 >                else
171                          printf("fx`%s(x):if(%g-x,if(x-%g,fx2`%s(x,%d),%d),1);\n",
172                                          locID, abscissa[0], abscissa[tabsize-1],
173                                          locID, tabsize, tabsize);
171                        printf("fx2`%s(x,i):if(X`%s(i)-x,\n", locID, locID);
172                }
173                printf("\ti+(x-X`%s(i))/(X`%s(i+1)-X`%s(i)),\n",
174                                locID, locID, locID);
175                printf("\tfx2`%s(x,i-1));\n", locID);
174                  sprintf(ourexp, "fx`%s(x)", locID);
175          }
176          return(ourexp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines