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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1927 - (view) (download)

1 : jhr 1115 // rsmp2d
2 :     //
3 :     // demos 2D convolution
4 :    
5 :     int dataSize = 11;
6 :     int imgSize = 200;
7 : jhr 1927 image(2)[] img = image ("../data/pix1-11.nrrd");
8 : jhr 1115 field#2(2)[] F = img ⊛ bspln3;
9 :    
10 :     strand sample (int ui, int vi)
11 :     {
12 :     vec2 pos = [lerp(-0.5, real(dataSize)-0.5, -0.5, real(ui), real(imgSize)-0.5),
13 :     lerp(-0.5, real(dataSize)-0.5, -0.5, real(vi), real(imgSize)-0.5)];
14 :     output vec3 vxy = [0.0,0.0,0.0];
15 :    
16 :     update
17 :     {
18 :     if (inside(pos,F)) {
19 :     vec2 grad = ∇F@pos;
20 :     vxy = [0.1 if F@pos > 0.01 else 0.0, grad[0], grad[1]];
21 :     }
22 :     stabilize;
23 :     }
24 :     }
25 :    
26 :     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