11namespace gtsam_points {
13static std::vector<float> read_times(
const std::string& path) {
14 std::ifstream ifs(path, std::ios::binary | std::ios::ate);
16 std::cerr <<
"error: failed to open " << path << std::endl;
17 return std::vector<float>();
20 std::streamsize points_bytes = ifs.tellg();
21 size_t num_data = points_bytes /
sizeof(float);
23 ifs.seekg(0, std::ios::beg);
24 std::vector<float> times(num_data);
25 ifs.read(
reinterpret_cast<char*
>(times.data()),
sizeof(
float) * num_data);
30static std::vector<Eigen::Vector3f> read_points(
const std::string& path) {
31 std::ifstream ifs(path, std::ios::binary | std::ios::ate);
33 std::cerr <<
"error: failed to open " << path << std::endl;
34 return std::vector<Eigen::Vector3f>();
37 std::streamsize points_bytes = ifs.tellg();
38 size_t num_points = points_bytes / (
sizeof(Eigen::Vector3f));
40 ifs.seekg(0, std::ios::beg);
41 std::vector<Eigen::Vector3f> points(num_points);
42 ifs.read(
reinterpret_cast<char*
>(points.data()),
sizeof(Eigen::Vector3f) * num_points);
47static std::vector<Eigen::Vector4f> read_points4(
const std::string& path) {
48 std::ifstream ifs(path, std::ios::binary | std::ios::ate);
50 std::cerr <<
"error: failed to open " << path << std::endl;
51 return std::vector<Eigen::Vector4f>();
54 std::streamsize points_bytes = ifs.tellg();
55 size_t num_points = points_bytes / (
sizeof(Eigen::Vector4f));
57 ifs.seekg(0, std::ios::beg);
58 std::vector<Eigen::Vector4f> points(num_points);
59 ifs.read(
reinterpret_cast<char*
>(points.data()),
sizeof(Eigen::Vector4f) * num_points);