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

SCM Repository

[diderot] Annotation of /branches/charisee/ertest/vispaper/tiso3d/detiso3d.diderot
ViewVC logotype

Annotation of /branches/charisee/ertest/vispaper/tiso3d/detiso3d.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3102 - (view) (download)

1 : glk 3090
2 :     /*
3 :    
4 :     ../../../bin/diderotc detiso3d.diderot \
5 :     && ./detiso3d \
6 :     && unu dice -i detiso3d.txt -a 0 -o ./ \
7 : glk 3102 && unu jhisto -i {0,1}.nrrd -b 400 400 -min -30 -30 -max 30 30 -t float | \
8 : glk 3090 unu 1op log1p | \
9 :     unu quantize -b 8 -o tmp.png \
10 : glk 3102 && unu jhisto -i {1,2}.nrrd -b 400 400 -min -30 -30 -max 30 30 -t float | \
11 : glk 3090 unu 1op log1p | \
12 :     unu quantize -b 8 | unu join -i tmp.png - -a 0 -o detiso3d.png \
13 :     && rm -f {0,1,2}.nrrd \
14 : glk 3102 && open detiso3d.png \
15 :     && unu jhisto -i detiso3d.txt -min -31 -31 -31 -max 31 31 31 -b 120 120 120 -t float \
16 :     | unu dnorm -i - \
17 :     | unu dist -th 0.5 \
18 :     | ~/hale/demo/iso -i -
19 : glk 3090
20 :     */
21 :    
22 : glk 3102 field#2(3)[3,3] V = bspln3 ⊛ image("tball.nrrd");
23 : glk 3090 field#2(3)[] F = det(V) - 0.02;
24 :    
25 : glk 3102 //field#1(3)[] V= bspln3 ⊛ image("tball-det.nrrd");
26 :     //field#1(3)[] F = V - 0.02;
27 : glk 3090
28 : glk 3102 int grid = 30;
29 :     int stepsMax = 30;
30 : glk 3090 real epsilon = 0.0001;
31 :    
32 :     strand RootFind(real xi,real xj, real xk) {
33 :     output vec3 x = [xi,xj,xk];
34 :     int steps = 0;
35 :     update {
36 :     // Stop if we're no longer inside or taken too many steps.
37 : glk 3102 if (!inside(x, F) || steps >= stepsMax)
38 :     stabilize;
39 : glk 3090 // subsequent expressions are undefined if |∇F| is zero
40 :     if (|∇F(x)| == 0.0)
41 :     die;
42 :     // the Newton-Raphson step
43 :     vec3 delta = normalize(∇F(x)) * F(x)/|∇F(x)|;
44 :     // we've converged if the change is small enough
45 :     if (|delta| < epsilon)
46 :     stabilize;
47 :     x -= delta;
48 :     steps += 1;
49 :     }
50 :     }
51 :    
52 : glk 3102 initially { RootFind(lerp(-30, 30, -0.5, ui, grid-0.5),
53 :     lerp(-30, 30, -0.5, vi, grid-0.5),
54 :     lerp(-30, 30, -0.5, wi, grid-0.5))
55 : glk 3090 | 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