File: AutoGlyph

package info (click to toggle)
dxsamples 4.4.0-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 26,348 kB
  • ctags: 1,513
  • sloc: ansic: 10,079; sh: 8,445; java: 1,772; makefile: 1,101
file content (45 lines) | stat: -rw-r--r-- 1,465 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
    // Import data
electrondensity = Import("watermolecule");
    // Partition the data
electrondensity = Partition(electrondensity);
    // Create about 200 sample points
sampled = Sample(electrondensity,200);
    // Color the samples
mapped = AutoColor(sampled);
    // Create a camera
camera = AutoCamera(mapped,"off-diagonal", resolution = 500, aspect = 1);
    // Create glyphs. By default the smallest will be 5 percent the size of
    // the largest (ratio = 0.05, and min = data min)
glyphs = AutoGlyph(mapped);
Display(glyphs,camera);

    // This time, make all the glyphs the same size
glyphs = AutoGlyph(mapped, ratio = 1);
Display(glyphs,camera);

    // This time, make the glyphs proportionally sized
glyphs = AutoGlyph(mapped, ratio = 0, min=0);
Display(glyphs,camera);
   
    // Take the gradient of the field
grad = Gradient(electrondensity);
    // Map the gradient field onto the samples
mapped = Map(sampled,grad);
    // Create glyphs. These will be vector glyphs, five times as long as
    // the default length
glyphs = AutoGlyph(mapped,scale=5, type="needle");
Display(glyphs,camera);


    // Create text glyphs from a set of sample points
plane = MapToPlane(electrondensity);
samples = Sample(plane,15);
dots = AutoGlyph(samples, scale = 0.1, ratio=1);
textglyphs = AutoGlyph(samples,"text");
textglyphs = Color(textglyphs,"red");
box = ShowBox(electrondensity);
collected = Collect(box,textglyphs, dots);
Display(collected, camera);