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

SCM Repository

[diderot] View of /branches/pure-cfg/test/zslice-etest.diderot
ViewVC logotype

View of /branches/pure-cfg/test/zslice-etest.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1536 - (download) (annotate)
Fri Oct 14 21:25:53 2011 UTC (8 years ago) by glk
File size: 926 byte(s)
test program for evecs and evals, based on spectral decomposition
int dataSizeX = 71;
int dataSizeY = 45;
int imgSizeX = 10*dataSizeX;
int imgSizeY = 10*dataSizeY;
vec3 orig = [0.0, 0.0, 6.0];
vec3 xVec = [1.0, 0.0, 0.0];
vec3 yVec = [0.0, 1.0, 0.0];
image(3)[] img = load("../data/etest.nrrd");
field#2(3)[] F = img ⊛ bspln3;

strand sample (int xi, int yi) {
    real xx = lerp(-0.5, real(dataSizeX)-0.5,   -0.5, real(xi), real(imgSizeX)-0.5);
    real yy = lerp(-0.5, real(dataSizeY)-0.5,   -0.5, real(yi), real(imgSizeY)-0.5);
    vec3 pos = orig + xx*xVec + yy*yVec;
    output real val = 0.0; 

    update
    {
        if (inside (pos,F)) {
	    tensor[3,3] H = ∇⊗∇F(pos);
	    //val = trace(H);
	    vec3{3} v = evecs(H);
            real{3} l = evals(H);
            tensor[3,3] R = l{0}*v{0}⊗v{0} + l{1}*v{1}⊗v{1} + l{2}*v{2}⊗v{2};
            val = |H - R|;
	}
        stabilize;
    }
}

initially [ sample(xi, yi) | yi in 0..(imgSizeY-1), xi in 0..(imgSizeX-1) ];

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