Loading a huge XYZ Point Cloud file
in
Programming Questions
•
2 months ago
Hello,
I have a simple Point Cloud .txt file, structured like this: "X Y Z r g b"
I've written the sketch to load it into an array class.
Problem is the file is 68 MB, and as soon as I hit "run" nothing happens. The sketch appears at the dock (mac) but there's no respond.
(by the way - the number of points is 1,778,686 (stringLength). might this number be outside the limits of
integer?)
Any tips on how to do it, without reducing the Point Cloud file's size?
Thanks
Tai
- Point[] pcloud;
- int pointNum = 0;
- void setup() {
- String[] lines = loadStrings("lifta txt.txt");
- pcloud = new Point[lines.length];
- for (int i = 0; i < lines.length; i++) {
- String[] pieces = splitTokens(lines[i]);
- if (pieces.length == 6) {
- pcloud[pointNum] = new Point(pieces);
- pointNum++;
- }
- }
- for (int i = 0; i < pointNum; i++) {
- println(i);
- }
- }
- class Point {
- float x;
- float y;
- float z;
- int r;
- int g;
- int b;
- public Point(String[] pieces) {
- x = float(pieces[0]);
- y = float(pieces[1]);
- z = float(pieces[2]);
- r = int(pieces[3]);
- g = int(pieces[4]);
- b = int(pieces[5]);
- }
- }
1