/* \fcnfh Computes alternative modulation scheme, obtained when there is no limb darkening or emitted flux. It just computes radius at which optical depth reaches toomuch being totally opaque the planet deeper than that. @returns modulation obtained -1 if toomuch was not reached */ static inline PREC_RES modulationm1(PREC_RES *tau, long last, /* Index of the last position it has to be at least 1 */ double toomuch, prop_samp *ip, /* Order is descending */ struct geometry *sg) { long i,ini; double ipv[2]; double muchrad; double srad=sg->starrad * sg->starradfct; if(tau[last]<toomuch) return -1; //Fill the unnormalized impact parameter array ini=++last-2; if(ini<0) ini=0; for(i=ini;i<last;i++) ipv[i-ini]=ip->v[i]*ip->fct; //find the minimum radius through linear interpolation muchrad = interp_line (tau+ini, ipv, toomuch); return muchrad*muchrad/srad/srad; }
int interpolate(Frame& frame, double max_distance, interpolation_func func) { //prevent stupidity if(max_distance == 0.0) return LZR_ERROR_INVALID_ARG; //a working buffer for us to build in Frame working; bool in_path = false; //whether or not the previous point was a lit point Point prev; for(size_t i = 0; i < frame.size(); i++) { Point p = frame[i]; if(p.is_blanked()) { in_path = false; } else if(!in_path) { in_path = true; } else { interp_line(working, max_distance, func, prev, p); } prev = p; working.add(p); } //write the finished points back to the user's frame frame = working; return LZR_SUCCESS; }