void splint2_clip(double *x1a,double *x2a,double *ya,double *y2a,int32 m,int32 n,double x2,double *x1,int32 nx1,double *y) { double *y1temp; double *yy1temp; double *y2temp; double *yy2temp; int i,j,k; y2temp = new double[m]; yy2temp = new double[m]; for (i=0; i<m; i++) { splint_0_clip(x2a,ya+i*n,y2a+i*n,n,x2,yy2temp + i); } spline_0(x1a,yy2temp,m,1.0e30,1.0e30,y2temp); for (k=0; k<nx1; k++) { splint_0_clip(x1a,yy2temp,y2temp,m,x1[k],y+k); } delete y2temp; delete yy2temp; }
void spline2(double *x1a,double *x2a,double *ya,int32 m,int32 n, double *y2a) { int i,j; for (i=0; i<m; i++) { spline_0(x2a,ya+i*n,n,1.0e30,1.0e30,y2a+i*n); } }
//save to input black table when window is closed McoStatus PrinterType::setblack(McoHandle blacktableH) { short i; double *black; double *y2_hands; double ypn; y2_hands = new double[num_hands]; black = (double*)McoLockHandle(blacktableH); ypn=(y_hands[num_hands-1]-y_hands[num_hands-2])/ (x_hands[num_hands-1]-x_hands[num_hands-2]); spline_0(x_hands,y_hands,num_hands,1E30,1E30,y2_hands); //L to Black table for( i = 0; i <= 100; i++) splint_0(x_hands,y_hands,y2_hands,num_hands,i, black+i); //fix on 8/23 //clipping the _yd_points which on the left of letfmost hand //to the value of the leftmost hand //on the right of rightmost hand to the value of the rightmost hand for( i = 0; i <= 100; i++){ if( i <= x_hands[0] ) //left of the leftmost hand black[i] = y_hands[0]; if( i >= x_hands[num_hands-1] ) //left of the leftmost hand black[i] = y_hands[num_hands-1]; } //clipping the table and normaliz to 1 for( i = 0; i <= 100; i++){ if(black[i] < 0) black[i] = 0; else if(black[i] > 100) black[i] = 1.0; else black[i] /= 100.0; } McoUnlockHandle(blacktableH); delete y2_hands; return MCO_SUCCESS; }
// use splines to linearize tables // the polaroid version (data is in density format) McoStatus LinearData::setUp(double *data,double *vals,int array_mult,int nc,int *s) { int i,j; double t,t2; McoStatus state = MCO_SUCCESS; double z,Ts,Tt; CleanUp(); numc = nc; sizes = new int32[numc]; curves = new double*[numc]; values = new double*[numc]; y2 = new double*[numc]; y3 = new double*[numc]; if ((sizes == 0L) || (curves == 0L) || (values == 0L) || (y2 == 0L) || (y3 == 0L)) return MCO_MEM_ALLOC_ERROR; for (i=0; i<numc; i++) { sizes[i] = s[i]; curves[i] = new double[sizes[i]]; values[i] = new double[sizes[i]]; y2[i] = new double[sizes[i]]; y3[i] = new double[sizes[i]]; if ((sizes[i] == 0L) || (curves[i] == 0L) || (values[i] == 0L) || (y2[i] == 0L) || (y3[i] == 0L)) return MCO_MEM_ALLOC_ERROR; for (j=0; j<sizes[i]; j++) { values[i][j] = vals[i*array_mult+j]; } } // build the curves for (i=0; i<numc; i++) { for (j=0; j<sizes[i]; j++) { curves[i][j] = data[i*array_mult+j]; } // remve any reversals from the data state = cleanReversals(curves[i],values[i],&sizes[i]); if (state != MCO_SUCCESS) goto bail; // use %dot z = curves[i][0]; Ts = pow(10,(-curves[i][sizes[i]-1]+z)); for (j=0; j<sizes[i]; j++) { Tt = pow(10,(-curves[i][j]+z)); curves[i][j] = 100*(1-Tt)/(1-Ts); } // set up the splines spline_0(values[i],curves[i],sizes[i],1.0e30,1.0e30,y2[i]); // set up the splines spline_0(curves[i],values[i],sizes[i],1.0e30,1.0e30,y3[i]); } bail: return state; }
// use splines to linearize tables McoStatus LinearData::setUp(double *data,double *vals, double *paper,int nc,int s) { int i,j; double t,t2; McoStatus state = MCO_SUCCESS; int LAB = 0; double z,Ts,Tt; CleanUp(); numc = nc; sizes = new int32[numc]; curves = new double*[numc]; values = new double*[numc]; y2 = new double*[numc]; y3 = new double*[numc]; if ((sizes == 0L) || (curves == 0L) || (values == 0L) || (y2 == 0L) || (y3 == 0L)) return MCO_MEM_ALLOC_ERROR; for (i=0; i<numc; i++) { sizes[i] = s; curves[i] = new double[s]; values[i] = new double[s]; y2[i] = new double[s]; y3[i] = new double[s]; if ((sizes[i] == 0L) || (curves[i] == 0L) || (values[i] == 0L) || (y2[i] == 0L) || (y3[i] == 0L)) return MCO_MEM_ALLOC_ERROR; for (j=0; j<s; j++) { values[i][j] = vals[j]; } } // determine if data is in density format // must have paper density subtracted for (i=0; i<numc; i++) { for (j=0; j<sizes[i]-1; j++) { if (fabs(data[i*(s-1)*3+j*3+1]) > 0.01) LAB = 1; if (fabs(data[i*(s-1)*3+j*3+2]) > 0.01) LAB = 1; } } // build the curves for (i=0; i<numc; i++) { curves[i][0] = 0; // 0% for (j=0; j<sizes[i]-1; j++) { if (LAB) { t = data[i*(s-1)*3+j*3]-paper[0]; t2 = t*t; t = data[i*(s-1)*3+j*3+1]-paper[1]; t2 += t*t; t = data[i*(s-1)*3+j*3+2]-paper[2]; t2 += t*t; curves[i][j+1] = sqrt(t2); } else curves[i][j+1] = data[i*(s-1)*3+j*3]; } // remve any reversals from the data state = cleanReversals(curves[i],values[i],&sizes[i]); if (state != MCO_SUCCESS) goto bail; // scale from 0 to 100 if lab if (LAB) for (j=0; j<sizes[i]; j++) curves[i][j] = 100*curves[i][j]/curves[i][sizes[i]-1]; else { z = curves[i][0]; Ts = pow(10,(-curves[i][sizes[i]-1]+z)); for (j=0; j<sizes[i]; j++) { Tt = pow(10,(-curves[i][j]+z)); curves[i][j] = 100*(1-Tt)/(1-Ts); } } // set up the splines spline_0(values[i],curves[i],sizes[i],1.0e30,1.0e30,y2[i]); // set up the splines spline_0(curves[i],values[i],sizes[i],1.0e30,1.0e30,y3[i]); } bail: return state; }