small_gicp
traits.hpp
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright 2024 Kenji Koide
2 // SPDX-License-Identifier: MIT
3 #pragma once
4 
5 #include <Eigen/Core>
6 
7 namespace small_gicp {
8 
9 namespace traits {
10 
11 template <typename T>
12 struct Traits;
13 
15 template <typename T>
16 size_t size(const T& points) {
17  return Traits<T>::size(points);
18 }
19 
21 template <typename T>
22 bool has_points(const T& points) {
23  return Traits<T>::has_points(points);
24 }
25 
27 template <typename T>
28 bool has_normals(const T& points) {
29  return Traits<T>::has_normals(points);
30 }
31 
33 template <typename T>
34 bool has_covs(const T& points) {
35  return Traits<T>::has_covs(points);
36 }
37 
39 template <typename T>
40 auto point(const T& points, size_t i) {
41  return Traits<T>::point(points, i);
42 }
43 
45 template <typename T>
46 auto normal(const T& points, size_t i) {
47  return Traits<T>::normal(points, i);
48 }
49 
51 template <typename T>
52 auto cov(const T& points, size_t i) {
53  return Traits<T>::cov(points, i);
54 }
55 
57 template <typename T>
58 void resize(T& points, size_t n) {
59  Traits<T>::resize(points, n);
60 }
61 
63 template <typename T>
64 void set_point(T& points, size_t i, const Eigen::Vector4d& pt) {
65  Traits<T>::set_point(points, i, pt);
66 }
67 
69 template <typename T>
70 void set_normal(T& points, size_t i, const Eigen::Vector4d& pt) {
71  Traits<T>::set_normal(points, i, pt);
72 }
73 
75 template <typename T>
76 void set_cov(T& points, size_t i, const Eigen::Matrix4d& cov) {
77  Traits<T>::set_cov(points, i, cov);
78 }
79 
80 } // namespace traits
81 } // namespace small_gicp
size_t size(const T &points)
Get the number of points.
Definition: traits.hpp:16
void set_cov(T &points, size_t i, const Eigen::Matrix4d &cov)
Set i-th covariance. Only the top-left 3x3 matrix should be filled.
Definition: traits.hpp:76
void set_normal(T &points, size_t i, const Eigen::Vector4d &pt)
Set i-th normal. (nx, nz, nz, 0)
Definition: traits.hpp:70
auto point(const T &points, size_t i)
Get i-th point. 4D vector is used to take advantage of SIMD intrinsics. The last element must be fill...
Definition: traits.hpp:40
bool has_covs(const T &points)
Check if the point cloud has covariances.
Definition: traits.hpp:34
bool has_points(const T &points)
Check if the point cloud has points.
Definition: traits.hpp:22
bool has_normals(const T &points)
Check if the point cloud has normals.
Definition: traits.hpp:28
auto cov(const T &points, size_t i)
Get i-th covariance. Only the top-left 3x3 matrix is filled, and the bottom row and the right col mus...
Definition: traits.hpp:52
auto normal(const T &points, size_t i)
Get i-th normal. 4D vector is used to take advantage of SIMD intrinsics. The last element must be fil...
Definition: traits.hpp:46
void set_point(T &points, size_t i, const Eigen::Vector4d &pt)
Set i-th point. (x, y, z, 1)
Definition: traits.hpp:64
void resize(T &points, size_t n)
Resize the point cloud (this function should resize all attributes)
Definition: traits.hpp:58
Definition: flat_container.hpp:12