SCM Repository
View of /trunk/rtest/tests/mip/mip.diderot
Parent Directory
|
Revision Log
Revision 3349 -
(download)
(annotate)
Tue Oct 27 15:16:36 2015 UTC (6 years, 6 months ago) by jhr
File size: 1465 byte(s)
Tue Oct 27 15:16:36 2015 UTC (6 years, 6 months ago) by jhr
File size: 1465 byte(s)
making copyrights consistent for all code in the repository
/*! \file mip.diderot * * \author Gordon Kindlmann */ /* * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu) * * COPYRIGHT (c) 2015 The University of Chicago * All rights reserved. */ // mip: // // does maximum intensity projection vec3 camEye = [6.65584, 13.2759, 8.55225]; vec3 camAt = [0, 0, 0]; vec3 camUp = [0, 0, 1]; real camNear = -1.0; real camFar = 1.0; real camFOV = 6.0; int imgResU = 320; int imgResV = 240; real rayStep = 0.01; real camDist = |camAt - camEye|; real camVspNear = camNear + camDist; real camVspFar = camFar + camDist; vec3 camN = normalize(camAt - camEye); vec3 camU = normalize(camN × camUp); vec3 camV = camN × camU; real camVmax = tan(camFOV*π/360.0)*camDist; real camUmax = camVmax*real(imgResU)/real(imgResV); field#0(3)[] F = tent ⊛ image("../../data/ring.nrrd"); strand RayCast (int ui, int vi) { real rayU = lerp(-camUmax, camUmax, -0.5, real(ui), real(imgResU)-0.5); real rayV = lerp(-camVmax, camVmax, -0.5, real(vi), real(imgResV)-0.5); vec3 rayVec = (camDist*camN + rayU*camU + rayV*camV)/camDist; real rayN = camVspNear; output real maxval = -0.6; update { vec3 rayPos = camEye + rayN*rayVec; if (inside (rayPos,F)) { maxval = max(maxval, F(rayPos)); } if (rayN > camVspFar) stabilize; rayN += rayStep; } } initially [ RayCast(ui, vi) | vi in 0..(imgResV-1), ui in 0..(imgResU-1) ];
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |