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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3149 - (download) (annotate)
Fri Mar 27 16:42:21 2015 UTC (4 years, 6 months ago) by jhr
File size: 1178 byte(s)
  Fixed confusion between tensor[1] and tensor[] when testing Inside of 1D field.
field#2(2)[] F = bspln3 ⊛ clamp(image("italy.nrrd"));

//field#0(1)[3] cmap = tent ⊛ image("italy-cmap.nrrd"); // fallback
field#0(1)[3] cmap = tent ⊛ clamp(image("italy-cmap.nrrd"));

//input vec3 ldir = [-1, 1, 1];
//input real sh = 0.5;
//input real ze = 1.0;
input vec2 cent;
input int sz0;
input int sz1;
input real hght;
input real angle = 0;

real cc = cos(π*angle/180);
real ss = sin(π*angle/180);
real spc = hght/sz1;      // spacing between samples (on either axis)
real wdth = sz0*hght/sz1; // width of viewing window
real xh = (wdth - spc)/2; // half of span of faster axis
real yh = (hght - spc)/2; // half of span of slower axis
tensor[3,3] ItoW = [[spc*cc,  spc*ss, cent[0] - cc*xh - ss*yh],
                    [spc*ss, -spc*cc, cent[0] - ss*xh + cc*yh],
                    [0, 0, 1]];

strand psamp(int ui, int vi) {
  vec3 hwpos = ItoW•[ui, vi, 1];
  vec2 wpos = [hwpos[0], hwpos[1]];
  output vec3 rgb = [0,0,0];

  update {
    //rgb = cmap(clamp(-2000,2000,F(wpos))); // fallback
    rgb = cmap(F(wpos));

    // TODO: compute shading, involving ∇F(wpos)
    stabilize;
  }
}

initially [ psamp(ui, vi) | vi in 0..(sz1-1), ui in 0..(sz0-1) ];

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