Ponca  bab7704293a2c36e5bed9dea40def7ba839bfe08
Point Cloud Analysis library
Loading...
Searching...
No Matches
defines.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include <type_traits> // std::true_type
10
19#include "../Common/defines.h"
20
21#define PONCA_EXPLICIT_CAST_OPERATORS(CLASSNAME, CONVERTER) \
22 \
23 PONCA_MULTIARCH inline CLASSNAME<DataPoint, _NFilter, T>& CONVERTER() \
24 { \
25 return *static_cast<CLASSNAME<DataPoint, _NFilter, T>*>(this); \
26 } \
27 \
28 PONCA_MULTIARCH inline const CLASSNAME<DataPoint, _NFilter, T>& CONVERTER() const \
29 { \
30 return *static_cast<const CLASSNAME<DataPoint, _NFilter, T>*>(this); \
31 }
32
33// CAST OPERATORS
34
35#define PONCA_EXPLICIT_CAST_OPERATORS_DER(CLASSNAME, CONVERTER) \
36 \
37 PONCA_MULTIARCH inline CLASSNAME<DataPoint, _NFilter, DiffType, T>& CONVERTER() \
38 { \
39 return *static_cast<CLASSNAME<DataPoint, _NFilter, DiffType, T>*>(this); \
40 } \
41 \
42 PONCA_MULTIARCH inline const CLASSNAME<DataPoint, _NFilter, DiffType, T>& CONVERTER() const \
43 { \
44 return *static_cast<const CLASSNAME<DataPoint, _NFilter, DiffType, T>*>(this); \
45 }
46
47// FIT DEFAULT TYPES
48
50#define PONCA_FITTING_DECLARE_DEFAULT_TYPES \
51protected: \
52 using Base = T; \
53public: \
54 using Scalar = typename DataPoint::Scalar; \
55 using VectorType = typename Base::VectorType; \
56 using NeighborFilter = typename Base::NeighborFilter;
59#define PONCA_FITTING_DECLARE_MATRIX_TYPE \
60public: \
61 using MatrixType = typename DataPoint::MatrixType;
64#define PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES \
65public: \
66 using ScalarArray = typename Base::ScalarArray; \
67 using VectorArray = typename Base::VectorArray;
69// FIT API DOCUMENTATION
70#define PONCA_FITTING_APIDOC_SETWFUNC \
71
73#define PONCA_FITTING_APIDOC_INIT \
74
76#define PONCA_FITTING_APIDOC_ADDNEIGHBOR
77#define PONCA_FITTING_APIDOC_ADDNEIGHBOR_DER
78#define PONCA_FITTING_APIDOC_FINALIZE \
79
81// FIT API DECLARATION
82
84#define PONCA_FITTING_IS_SIGNED(IS_SIGNED) \
85 \
86 PONCA_MULTIARCH inline constexpr bool isSigned() { return IS_SIGNED; }
87
89#define PONCA_FITTING_DECLARE_INIT \
90 PONCA_FITTING_APIDOC_INIT \
91 PONCA_MULTIARCH inline void init();
92
94#define PONCA_FITTING_DECLARE_ADDNEIGHBOR \
95 PONCA_FITTING_APIDOC_ADDNEIGHBOR \
96 PONCA_MULTIARCH inline void addLocalNeighbor(Scalar w, const VectorType& localQ, const DataPoint& attributes);
97
99#define PONCA_FITTING_DECLARE_ADDNEIGHBOR_DER \
100 PONCA_FITTING_APIDOC_ADDNEIGHBOR_DER \
101 PONCA_MULTIARCH inline void addLocalNeighbor(Scalar w, const VectorType& localQ, const DataPoint& attributes, \
102 ScalarArray& dw);
103
105#define PONCA_FITTING_DECLARE_FINALIZE \
106 PONCA_FITTING_APIDOC_FINALIZE \
107 PONCA_MULTIARCH inline FIT_RESULT finalize();
108
109#define PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE \
110 PONCA_FITTING_DECLARE_INIT \
111 PONCA_FITTING_DECLARE_ADDNEIGHBOR \
112 PONCA_FITTING_DECLARE_FINALIZE
113
114#define PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE \
115 PONCA_FITTING_DECLARE_INIT \
116 PONCA_FITTING_DECLARE_ADDNEIGHBOR_DER \
117 PONCA_FITTING_DECLARE_FINALIZE
118
119namespace Ponca
120{
122 template <typename T, typename = void>
123 struct hasFirstFundamentalForm : std::false_type
124 {
125 };
127 template <typename T>
128 struct hasFirstFundamentalForm<T, std::void_t<decltype(std::declval<T>().firstFundamentalForm())>> : std::true_type
129 {
130 };
131
132} // namespace Ponca
133
This Source Code Form is subject to the terms of the Mozilla Public License, v.
\FIXME create a macro to automatically generate the testing functions
Definition defines.h:122