File: Util.pde

package info (click to toggle)
libvpx 1.15.0-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 27,004 kB
  • sloc: ansic: 252,377; cpp: 115,241; asm: 22,233; sh: 5,289; python: 4,391; perl: 2,010; makefile: 431
file content (28 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (19)
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
// show grids
void showGrids(int block_size) {
  ortho(-width, 0, -height, 0);
  camera(0, 0, 0, 0, 0, 1, 0, 1, 0);
  stroke(0, 0, 255);
  for (int i = 0; i < height; i += block_size) {
    line(0, i, width, i);
  }
  for (int i = 0; i < width; i += block_size) {
    line(i, 0, i, height);
  }
}

// save the point clould information
void savePointCloud(PointCloud point_cloud, String file_name) {
  String[] positions = new String[point_cloud.points.size()];
  String[] colors = new String[point_cloud.points.size()];
  for (int i = 0; i < point_cloud.points.size(); i++) {
    PVector point = point_cloud.getPosition(i);
    color point_color = point_cloud.getColor(i);
    positions[i] = str(point.x) + ' ' + str(point.y) + ' ' + str(point.z);
    colors[i] = str(((point_color >> 16) & 0xFF) / 255.0) + ' ' +
                str(((point_color >> 8) & 0xFF) / 255.0) + ' ' +
                str((point_color & 0xFF) / 255.0);
  }
  saveStrings(file_name + "_pos.txt", positions);
  saveStrings(file_name + "_color.txt", colors);
}