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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3063 - (view) (download)
Original Path: branches/charisee/test/rsmp2d.diderot

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