31 #include <riegl/scanifc.h> 46 return read(filename, 1, Transformd::Identity());
51 if (reduction_factor < 1)
57 point3dstream_handle stream;
58 if (check_error(scanifc_point3dstream_open((
"file:" + filename).c_str(), 0, &stream)))
63 std::vector<BaseVector<float> > data;
66 const unsigned int point_buf_size = 32768;
67 scanifc_xyz32_t point_buf[point_buf_size];
77 if (check_error(scanifc_point3dstream_read(stream, point_buf_size, point_buf, 0, 0, &got, &end_of_frame)))
83 for (
int i = 0; i < got; i++)
85 if (count++ % reduction_factor == 0)
87 cur_point.
x = point_buf[i].x;
88 cur_point.
y = point_buf[i].y;
89 cur_point.
z = point_buf[i].z;
91 data.push_back(tf * cur_point);
95 }
while(end_of_frame || got);
99 float *data2 =
new float[data.size() * 3];
100 assert(data2 !=
nullptr);
103 for (
int i = 0; i < data.size(); i++)
105 data2[i*3 + 0] = data[i].x;
106 data2[i*3 + 1] = data[i].y;
107 data2[i*3 + 2] = data[i].z;
111 pbp->setPointArray(
floatArr(data2), data.size());
114 if (check_error(scanifc_point3dstream_close(stream)))
124 std::cout <<
"[RxpIO] Error: Saving files to .rxp format is not supported" << std::endl;
127 bool RxpIO::check_error(
int error_code)
132 unsigned int msg_buf_size = 2048;
133 char msg_buf[msg_buf_size];
134 unsigned int msg_size = 0;
136 scanifc_get_last_error(msg_buf, msg_buf_size, &msg_size);
138 std::cout <<
"[RxpIO] Error: " << msg_buf << std::endl;
A class to handle point information with an arbitrarily large number of attribute channels...
std::shared_ptr< MeshBuffer > MeshBufferPtr
std::shared_ptr< PointBuffer > PointBufferPtr
void save(std::string filename)
This function is not supported and will do nothing.
Transform< double > Transformd
4x4 double precision transformation matrix
boost::shared_array< float > floatArr
std::shared_ptr< Model > ModelPtr
ModelPtr read(std::string filename)
Reads .rxp files.