File: CollectMultiGrid

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 (49 lines) | stat: -rw-r--r-- 1,734 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
46
47
48
49
// The following two grids are non-overlapping
grid1 = Construct([0 0], [1 1], [4 4], {1 .. 16});
grid2 = Construct([3 3], [1 1], [4 4], {33 .. 48});

// Collect is used to create a generic group. When colored using AutoColor,
// each will be colored independently.
group = Collect(grid1,NULL, grid2);
colored = AutoColor(group);
camera = AutoCamera(group);
Display(colored, camera);
KeyIn();

// CollectMultiGrid is used to create a multigrid group. When colored using 
// AutoColor, the multigrid will be colored as a single entity.
multigrid = CollectMultiGrid(grid1,NULL, grid2);
colored = AutoColor(multigrid);
camera = AutoCamera(multigrid);
Display(colored, camera);
KeyIn();

// The following two grids are overlapping
grid1 = Construct([0 0], [1 1], [4 4], {1 .. 16});
grid2 = Construct([2 2], [1 1], [4 4], {33 .. 48});

// In this case, the one position of grid1 completely within the 
// overlapping region is labeled invalid.
invalid = {0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1};
invalid = Compute("byte($0)", invalid);
invalid = Options(invalid,"dep", "positions");
grid1inv = Replace(invalid, grid1, NULL, "invalid positions");
multigrid = CollectMultiGrid(grid1inv,NULL, grid2);
colored = AutoColor(multigrid);
camera = AutoCamera(multigrid);
Display(colored, camera);
KeyIn();

// In this case, the one position of grid2 completely within the 
// overlapping region is labeled invalid.
invalid = {1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0};
invalid = Compute("byte($0)", invalid);
invalid = Options(invalid,"dep", "positions");
grid2inv = Replace(invalid, grid2, NULL, "invalid positions");
multigrid = CollectMultiGrid(grid1,NULL, grid2inv);
colored = AutoColor(multigrid);
camera = AutoCamera(multigrid);
Display(colored, camera);