Ponca  292d8d7132745e0d4242ff9a01e93697fc96b204
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#include "../Common/floatutils.h"
21
22#define PONCA_EXPLICIT_CAST_OPERATOR(CONVERTER, ...) \
23 \
24 PONCA_MULTIARCH inline __VA_ARGS__& CONVERTER() { return *static_cast<__VA_ARGS__*>(this); } \
25 \
26 PONCA_MULTIARCH inline const __VA_ARGS__& CONVERTER() const { return *static_cast<const __VA_ARGS__*>(this); }
27
28#define PONCA_EXPLICIT_BASKET_CAST_OPERATORS(CLASSNAME, CONVERTER) \
29 PONCA_EXPLICIT_CAST_OPERATOR(CONVERTER, CLASSNAME<DataPoint, _NFilter, T>)
30
31// CAST OPERATORS
32
33#define PONCA_EXPLICIT_BASKET_CAST_OPERATORS_DER(CLASSNAME, CONVERTER) \
34 PONCA_EXPLICIT_CAST_OPERATOR(CONVERTER, CLASSNAME<DataPoint, _NFilter, DiffType, T>)
35
36// FIT DEFAULT TYPES
37
39#define PONCA_FITTING_DECLARE_DEFAULT_TYPES \
40protected: \
41 using Base = T; \
42public: \
43 using Scalar = typename DataPoint::Scalar; \
44 using VectorType = typename Base::VectorType; \
45 using NeighborFilter = typename Base::NeighborFilter;
46
48#define PONCA_FITTING_DECLARE_MULTIPASS_TYPES \
49protected: \
50 using Base = MultipassStatus<DataPoint, _NFilter, T>; \
51 using Status = Base; \
52public: \
53 using Scalar = typename DataPoint::Scalar; \
54 using VectorType = typename Base::VectorType; \
55 using NeighborFilter = typename Base::NeighborFilter;
56
58#define PONCA_FITTING_DECLARE_MATRIX_TYPE \
59public: \
60 using MatrixType = typename DataPoint::MatrixType;
61
63#define PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES \
64public: \
65 using ScalarArray = typename Base::ScalarArray; \
66 using VectorArray = typename Base::VectorArray;
67
68// FIT API DOCUMENTATION
69#define PONCA_FITTING_APIDOC_SETWFUNC
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
80
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 [[nodiscard]] 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 };
126
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.
Definition concepts.h:11
\FIXME create a macro to automatically generate the testing functions
Definition defines.h:123