Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /trunk/rtest/tests/sum-ghp/sum-ghp.diderot
ViewVC logotype

View of /trunk/rtest/tests/sum-ghp/sum-ghp.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1193 - (download) (annotate)
Wed May 11 18:47:48 2011 UTC (8 years, 4 months ago) by glk
File size: 1342 byte(s)
making slow tests run faster
vec3 camEye = [6.65584, 13.2759, 8.55225];
vec3 camAt = [0.0, 0.0, 0.0];
vec3 camUp = [0.0, 0.0, 1.0];
real camNear = -1.0;
real camFar = 1.0;
real camFOV = 6.0;
int imgResU = 320;
int imgResV = 240;
real rayStep = 0.06; // HEY: this is large only because program is slow

real camDist = |camAt - camEye|;
real camVspNear = camNear + camDist;
real camVspFar = camFar + camDist;
vec3 camN = normalize(camAt - camEye);
vec3 camU = normalize(camN × camUp);
vec3 camV = camN × camU;
real camVmax = tan(camFOV*π/360.0)*camDist;
real camUmax = camVmax*real(imgResU)/real(imgResV);

field#2(3)[] F = bspln3 ⊛ load("../../data/ring.nrrd");

strand RayCast (int ui, int vi) {
    real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5);
    real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5);
    vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist;

    real rayN = camVspNear;
    output vec3 sum = [0.0,0.0,0.0];

    update {
        vec3 rayPos = camEye + rayN*rayVec;
        if (inside (rayPos,F)) {
          vec3 prod = ∇(∇F)(rayPos) • ∇F(rayPos);
          sum = sum + [prod•camU, prod•camV, prod•camN];
	}
        if (rayN > camVspFar) 
            stabilize;
        rayN = rayN + rayStep;
    }
}

initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0