/* * evaluate_orbital: evaluate an atomic orbital at some position (x, y, z). * * Input: * orb = orbital basis function * pos = (x, y, z) * scr = scratch array to hold |R - r| (3 * sizeof(double)) */ double evaluate_orbital(struct ao_basisfunc orb, double *pos, double *scr) { double value = 0.0; /* Return value */ switch (orb.type) { case 1: value = evaluate_s(pos, orb.alpha, orb.ccoef, orb.ugaus, orb.gscale, orb.geom); break; case 2: case 3: case 4: value = evaluate_p(pos, orb.alpha, orb.ccoef, orb.ugaus, orb.gscale, orb.geom, orb.type, scr); break; case 5: case 6: case 7: case 8: case 9: value = evaluate_d(pos, orb.alpha, orb.ccoef, orb.ugaus, orb.gscale, orb.geom, orb.type, scr); break; case 10: case 11: case 12: case 13: case 14: case 15: case 16: value = evaluate_f(pos, orb.alpha, orb.ccoef, orb.ugaus, orb.gscale, orb.geom, orb.type, scr); break; default: error_message("Unknown orbital type", "evaluate_orbital"); break; } return value; }
//Impl Spectrum BxDF::evaluate_sample_f(glm::vec3 outgoing_w, glm::vec3* incident_w, float u1, float u2, float* pdf) const { //Better use cosine_sample when I learn the required math *incident_w = cosine_sample_hemisphere(u1, u2); if (outgoing_w.z < 0.) incident_w->z *= -1.f; *pdf = calc_pdf(outgoing_w, *incident_w); return evaluate_f(outgoing_w, *incident_w); }
int main(){ int n, sep, seg; int **iptr; int i, j, k; scanf("%d %d", &n, &sep); iptr = (int**)malloc(sizeof(int*)*n); i = 0; while(i<n){ seg = (n-i>=sep?sep:n-i); iptr[i] = (int*)malloc(sizeof(int)*2*seg); i ++; seg --; while(seg>0){ iptr[i] = iptr[i-1] + 2; i++; seg --; } } for(i=0; i<n; i++) scanf("%d %d", &iptr[i][0], &iptr[i][1]); j = evaluate_f( iptr, n, &k ); printf("%d %d\n", j, k); }