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

SCM Repository

[diderot] View of /branches/charisee/ertest/vispaper/iso3d/crviso3d.diderot
ViewVC logotype

View of /branches/charisee/ertest/vispaper/iso3d/crviso3d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2916 - (download) (annotate)
Mon Mar 2 22:55:56 2015 UTC (6 years, 3 months ago) by glk
File size: 1744 byte(s)
not sure what's going on here crviso3d.diderot
/*

../../../bin/diderotc crviso3d.diderot \
&& ./crviso3d \
&& unu crop -i crviso3d.txt -min 0 0 -max 1 M | \
   unu jhisto -b 600 600 -min -1.2 -1.2 -max 1.2 1.2 -t float | \
   unu 1op log1p | \
   unu quantize -b 8 -o crviso3d.png \
&& open crviso3d.png

*/

/* BUG:
translate (_t01ED, |()|00A1, ...)
uncaught exception Fail [Fail: unsupported norm of fieldTy]
  raised at common/phase-timer.sml:76.50-76.52
  raised at translate/translate.sml:338.29-338.31
  raised at translate/translate.sml:329.29-329.31
  raised at translate/translate-basis.sml:318.41-318.43
  raised at translate/translate-basis.sml:215.58-215.91
*/

field#4(3)[] V= c4hexic ⊛ load("parab0.nrrd");

field#3(3)[3] N = ∇V/|∇V|;
field#2(3)[] F = |∇⊗N| - 0.1;         // neither this...
//field#2(3)[] F = (∇⊗N):(∇⊗N) - 0.1;   //... nor this are C2 differentiable, but they should be

int grid = 30;
int stepsMax = 10;
real epsilon = 0.000001;

strand RootFind(real xi,real xj, real xk) {
   output vec3 x = [xi,xj,xk];
   int steps = 0;
   update {
      // Stop if we're no longer inside or taken too many steps.
      if (!inside(x, V) || steps > stepsMax)
         die;
      // subsequent expressions are undefined if |∇F| is zero
      if (|∇F(x)| == 0.0)
         die;
      // the Newton-Raphson step
      vec3 delta = normalize(∇F(x)) * F(x)/|∇F(x)|;
      // we've converged if the change is small enough
      if (|delta| < epsilon)
         stabilize;
      x -= delta;
      steps += 1;
   }
}

initially { RootFind(lerp(-2, 2, -0.5, ui, grid-0.5),
                     lerp(-2, 2, -0.5, vi, grid-0.5),
                     lerp(-2, 2, -0.5, wi, grid-0.5))
            | wi in 0..(grid-1), vi in 0..(grid-1), ui in 0..(grid-1) };

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