|
8 | 8 | #include <opencv2/imgproc.hpp>
|
9 | 9 | #include <rerun.hpp>
|
10 | 10 |
|
11 |
| -// Adapters so we can log eigen vectors as rerun positions: |
12 |
| -template <> |
13 |
| -struct rerun::ComponentBatchAdapter<rerun::Position3D, std::vector<Eigen::Vector3f>> { |
14 |
| - // Sanity check that this is binary compatible. |
15 |
| - static_assert(sizeof(rerun::Position3D) == sizeof(Eigen::Vector3f)); |
16 |
| - static_assert(alignof(rerun::Position3D) <= alignof(Eigen::Vector3f)); |
17 |
| - |
18 |
| - ComponentBatch<rerun::Position3D> operator()(const std::vector<Eigen::Vector3f>& container) { |
19 |
| - return ComponentBatch<rerun::Position3D>::borrow( |
20 |
| - reinterpret_cast<const rerun::Position3D*>(container.data()), |
21 |
| - container.size() |
22 |
| - ); |
23 |
| - } |
24 |
| - |
25 |
| - ComponentBatch<rerun::Position3D> operator()(std::vector<Eigen::Vector3f>&& container) { |
26 |
| - throw std::runtime_error("Not implemented for temporaries"); |
27 |
| - } |
28 |
| -}; |
29 |
| - |
30 |
| -// Adapters so we can log an eigen matrix as rerun positions: |
31 |
| -template <> |
32 |
| -struct rerun::ComponentBatchAdapter<rerun::Position3D, Eigen::Matrix3Xf> { |
33 |
| - // Sanity check that this is binary compatible. |
34 |
| - static_assert( |
35 |
| - sizeof(rerun::Position3D) == |
36 |
| - sizeof(Eigen::Matrix3Xf::Scalar) * Eigen::Matrix3Xf::RowsAtCompileTime |
37 |
| - ); |
38 |
| - static_assert(alignof(rerun::Position3D) <= alignof(Eigen::Matrix3Xf)); |
39 |
| - |
40 |
| - ComponentBatch<rerun::Position3D> operator()(const Eigen::Matrix3Xf& matrix) { |
41 |
| - return ComponentBatch<rerun::Position3D>::borrow( |
42 |
| - reinterpret_cast<const rerun::Position3D*>(matrix.data()), |
43 |
| - matrix.cols() |
44 |
| - ); |
45 |
| - } |
46 |
| - |
47 |
| - ComponentBatch<rerun::Position3D> operator()(std::vector<Eigen::Matrix3Xf>&& container) { |
48 |
| - throw std::runtime_error("Not implemented for temporaries"); |
49 |
| - } |
50 |
| -}; |
| 11 | +#include "batch_adapters.hpp" |
51 | 12 |
|
52 | 13 | std::vector<Eigen::Vector3f> generate_random_points_vector(int num_points) {
|
53 | 14 | std::vector<Eigen::Vector3f> points(num_points);
|
|
0 commit comments