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

SCM Repository

[diderot] View of /branches/vis12/test/rsmp2d.diderot
ViewVC logotype

View of /branches/vis12/test/rsmp2d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1685 - (download) (annotate)
Sun Jan 22 15:23:36 2012 UTC (7 years, 8 months ago) by jhr
File size: 681 byte(s)
  Create a branch to implement things that we need for the Vis 2012 paper
// rsmp2d
//
// demos 2D convolution

string dataFile = "../data/pix1-11.nrrd";
int dataSize = 11;
int imgSize = 200;
image(2)[] img = load (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