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 2905 - (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 :     //__________________ things that aren't working
28 :    
29 : glk 2899 // lifting vector op to constant vector and field: does not work?
30 : glk 2901 // [iso3d.diderot:24.1-25.0] Error: type error for arguments of binary operator "•"
31 :     // found: (field#1(3)[3] * vec3)
32 : glk 2902 //field#1(3)[] F = ∇V • [1,0,0];
33 : glk 2901
34 :     // lifting vector op to constant vector and field: does not work?
35 : glk 2902 // [iso3d.diderot:27.18-34] Error: unable to resolve overloaded operator '-'
36 :     // argument type is: (field#1(3)[3] * vec3)
37 : glk 2905 //field#1(3)[] F = |∇V - [1,0,0]|;
38 : glk 2899
39 : glk 2901 // trying operation on a normalized gradient; never seems to finish compiling
40 :     // eventually starts printing things like:
41 :     // ../../../bin/diderotc: Error -- unable to map 1071775744 bytes, errno = 12
42 :     // ../../../bin/diderotc: Error -- unable to allocate to-space for generation 5; trying smaller size
43 :     // ../../../bin/diderotc: Error -- unable to map 1073152000 bytes, errno = 12
44 :     // ../../../bin/diderotc: Error -- unable to allocate to-space for generation 5; trying smaller size
45 : glk 2905 field#1(3)[3] N = ∇V/|∇V|;
46 :     field#1(3)[] F = ∇•N;
47 : glk 2901
48 : glk 2899 int grid = 30;
49 :     int stepsMax = 10;
50 :     real epsilon = 0.000001;
51 :    
52 :     strand RootFind(real xi,real xj, real xk) {
53 :     output vec3 x = [xi,xj,xk];
54 :     int steps = 0;
55 :     update {
56 :     // Stop if we're no longer inside or taken too many steps.
57 :     if (!inside(x, V) || steps > stepsMax)
58 :     die;
59 :     // subsequent expressions are undefined if |∇F| is zero
60 :     if (|∇F(x)| == 0.0)
61 :     die;
62 :     // the Newton-Raphson step
63 :     vec3 delta = normalize(∇F(x)) * F(x)/|∇F(x)|;
64 :     // we've converged if the change is small enough
65 :     if (|delta| < epsilon)
66 :     stabilize;
67 :     x -= delta;
68 :     steps += 1;
69 :     }
70 :     }
71 :    
72 :     initially { RootFind(lerp(-2, 2, -0.5, ui, grid-0.5),
73 :     lerp(-2, 2, -0.5, vi, grid-0.5),
74 :     lerp(-2, 2, -0.5, wi, grid-0.5))
75 :     | 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