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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2402 - (download) (annotate)
Sat Jul 27 13:55:03 2013 UTC (6 years, 2 months ago) by jhr
File size: 654 byte(s)
  Create branch for adding OpenCL to vis12 branch.  Based on r2401 of the vis12 branch.
// rsmp2d
//
// demos 2D convolution

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