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

SCM Repository

[diderot] View of /trunk/test/rsmp2d.diderot
ViewVC logotype

View of /trunk/test/rsmp2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3064 - (download) (annotate)
Sat Mar 14 13:38:34 2015 UTC (4 years, 4 months ago) by jhr
File size: 684 byte(s)
  updates to test programs
// rsmp2d
//
// demos 2D convolution

string dataFile = "../data/pix1-11.nrrd";
int dataSize = 11;
int imgSize = 200;
image(2)[] img = image (dataFile);
field#2(2)[] F = img ⊛ bspln3;

strand sample (int ui, int vi)
{
    vec2 pos = [lerp(-0.5, real(dataSize)-0.5, -0.5, real(ui), real(imgSize)-0.5),
                lerp(-0.5, real(dataSize)-0.5, -0.5, real(vi), real(imgSize)-0.5)];
    output vec3 vxy = [0.0,0.0,0.0];

    update
    {
        if (inside(pos,F)) {
          vec2 grad = ∇F(pos);
          vxy = [0.1 if F(pos) > 0.01 else 0.0, grad[0], grad[1]];
        }
        stabilize;
    }
}

initially [ sample(ui, vi) | vi in 0..(imgSize-1), ui in 0..(imgSize-1) ];

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