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

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2912 - (view) (download)

1 : glk 2899
2 :     /*
3 :    
4 :     ../../../bin/diderotc iso3d.diderot \
5 :     && ./iso3d \
6 :     && unu crop -i iso3d.txt -min 0 0 -max 1 M | \
7 :     unu jhisto -b 600 600 -min -1.2 -1.2 -max 1.2 1.2 -t float | \
8 :     unu 1op log1p | \
9 :     unu quantize -b 8 -o iso3d.png \
10 :     && open iso3d.png
11 :    
12 :     */
13 :    
14 :     field#2(3)[] V= bspln3 ⊛ load("parab0.nrrd");
15 :     field#2(3)[] U= bspln3 ⊛ load("parab1.nrrd");
16 :    
17 :     // isosurface of V itself: works
18 :     //field#1(3)[] F = V - 0.5;
19 :    
20 :     // isosurface of |∇V|: works
21 :     //field#1(3)[] F = |∇V| - 1;
22 :    
23 : glk 2905 // lifting vector op to two fields
24 :     //field#1(3)[] F = ∇V • ∇U - 1; // does work
25 :     //field#1(3)[] F = |∇V - ∇U| - 0.5; // does work
26 :    
27 : glk 2912 // lifting vector op to constant vector and field: seems to work as of r2906
28 :     //field#1(3)[] F = |∇V - [0.5,0,0]| - 0.5;
29 :    
30 : glk 2905 //__________________ things that aren't working
31 :    
32 : glk 2912 // BUG1: lifting vector op to constant vector and field: does not work?
33 : glk 2901 // [iso3d.diderot:24.1-25.0] Error: type error for arguments of binary operator "•"
34 :     // found: (field#1(3)[3] * vec3)
35 : glk 2912 field#1(3)[] F = ∇V • [1,0,0];
36 : glk 2901
37 : glk 2912 // BUG2: trying operation on a normalized gradient; never seems to finish compiling
38 : glk 2901 // eventually starts printing things like:
39 :     // ../../../bin/diderotc: Error -- unable to map 1071775744 bytes, errno = 12
40 :     // ../../../bin/diderotc: Error -- unable to allocate to-space for generation 5; trying smaller size
41 :     // ../../../bin/diderotc: Error -- unable to map 1073152000 bytes, errno = 12
42 :     // ../../../bin/diderotc: Error -- unable to allocate to-space for generation 5; trying smaller size
43 : glk 2912 //field#1(3)[3] N = ∇V/|∇V|;
44 : cchiw 2906 //field#1(3)[] F = ∇•N;
45 : glk 2901
46 : glk 2899 int grid = 30;
47 :     int stepsMax = 10;
48 :     real epsilon = 0.000001;
49 :    
50 :     strand RootFind(real xi,real xj, real xk) {
51 :     output vec3 x = [xi,xj,xk];
52 :     int steps = 0;
53 :     update {
54 :     // Stop if we're no longer inside or taken too many steps.
55 :     if (!inside(x, V) || steps > stepsMax)
56 :     die;
57 :     // subsequent expressions are undefined if |∇F| is zero
58 :     if (|∇F(x)| == 0.0)
59 :     die;
60 :     // the Newton-Raphson step
61 :     vec3 delta = normalize(∇F(x)) * F(x)/|∇F(x)|;
62 :     // we've converged if the change is small enough
63 :     if (|delta| < epsilon)
64 :     stabilize;
65 :     x -= delta;
66 :     steps += 1;
67 :     }
68 :     }
69 :    
70 :     initially { RootFind(lerp(-2, 2, -0.5, ui, grid-0.5),
71 :     lerp(-2, 2, -0.5, vi, grid-0.5),
72 :     lerp(-2, 2, -0.5, wi, grid-0.5))
73 :     | 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