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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2914 - (download) (annotate)
Mon Mar 2 22:48:35 2015 UTC (4 years, 6 months ago) by glk
File size: 2683 byte(s)
examples of trying to get total curvature
/*

../../../bin/diderotc iso3d.diderot \
&& ./iso3d \
&& unu crop -i iso3d.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 iso3d.png \
&& open iso3d.png

*/

field#2(3)[] V= bspln3 ⊛ load("parab0.nrrd");
field#2(3)[] U= bspln3 ⊛ load("parab1.nrrd");

// isosurface of V itself: works
//field#1(3)[] F = V - 0.5;

// isosurface of |∇V|: works
//field#1(3)[] F = |∇V| - 1;

// lifting vector op to two fields
//field#1(3)[] F = ∇V • ∇U - 1;  // does work
//field#1(3)[] F = |∇V - ∇U| - 0.5; // does work

// lifting vector op to constant vector and field: seems to work as of r2906
//field#1(3)[] F = |∇V - [0.5,0,0]| - 0.5;

//__________________ things that aren't working

// BUG1: lifting vector op to constant vector and field: does not work?
//   [iso3d.diderot:24.1-25.0] Error: type error for arguments of binary operator "•"
//    found: (field#1(3)[3] * vec3)
field#1(3)[] F = ∇V • [1,0,0];

// BUG2: trying operation on a normalized gradient; never seems to finish compiling
// eventually starts printing things like:
//   ../../../bin/diderotc: Error -- unable to map 1071775744 bytes, errno = 12
//   ../../../bin/diderotc: Error -- unable to allocate to-space for generation 5; trying smaller size
//   ../../../bin/diderotc: Error -- unable to map 1073152000 bytes, errno = 12
//   ../../../bin/diderotc: Error -- unable to allocate to-space for generation 5; trying smaller size
//field#1(3)[3] N = ∇V/|∇V|;
//field#1(3)[] F = ∇•N;

// BUG3: trying to take norm of jacobian of normal (total curvature)
//field#1(3)[3] N = ∇V/|∇V|;
//field#1(3)[] F = |∇⊗N| - 0.1;         // neither this
//field#1(3)[] F = (∇⊗N):(∇⊗N) - 0.1;   // nor this are C1 differentiable

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