Ponca  eb7239a9c07e156fb1edc6faac7fe89e2b256bda
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_OPERATOR(CONVERTER, ...) \
22 \
23 PONCA_MULTIARCH inline __VA_ARGS__& CONVERTER() { return *static_cast<__VA_ARGS__*>(this); } \
24 \
25 PONCA_MULTIARCH inline const __VA_ARGS__& CONVERTER() const { return *static_cast<const __VA_ARGS__*>(this); }
26
27#define PONCA_EXPLICIT_BASKET_CAST_OPERATORS(CLASSNAME, CONVERTER) \
28 PONCA_EXPLICIT_CAST_OPERATOR(CONVERTER, CLASSNAME<DataPoint, _NFilter, T>)
29
30// CAST OPERATORS
31
32#define PONCA_EXPLICIT_BASKET_CAST_OPERATORS_DER(CLASSNAME, CONVERTER) \
33 PONCA_EXPLICIT_CAST_OPERATOR(CONVERTER, CLASSNAME<DataPoint, _NFilter, DiffType, T>)
34
35// FIT DEFAULT TYPES
36
38#define PONCA_FITTING_DECLARE_DEFAULT_TYPES \
39protected: \
40 using Base = T; \
41public: \
42 using Scalar = typename DataPoint::Scalar; \
43 using VectorType = typename Base::VectorType; \
44 using NeighborFilter = typename Base::NeighborFilter;
45
47#define PONCA_FITTING_DECLARE_MULTIPASS_TYPES \
48protected: \
49 using Base = MultipassStatus<DataPoint, _NFilter, T>; \
50 using Status = Base; \
51public: \
52 using Scalar = typename DataPoint::Scalar; \
53 using VectorType = typename Base::VectorType; \
54 using NeighborFilter = typename Base::NeighborFilter;
55
57#define PONCA_FITTING_DECLARE_MATRIX_TYPE \
58public: \
59 using MatrixType = typename DataPoint::MatrixType;
60
62#define PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES \
63public: \
64 using ScalarArray = typename Base::ScalarArray; \
65 using VectorArray = typename Base::VectorArray;
66
67// FIT API DOCUMENTATION
68#define PONCA_FITTING_APIDOC_SETWFUNC
72#define PONCA_FITTING_APIDOC_INIT \
73
75#define PONCA_FITTING_APIDOC_ADDNEIGHBOR
76#define PONCA_FITTING_APIDOC_ADDNEIGHBOR_DER
77#define PONCA_FITTING_APIDOC_FINALIZE
79
80// FIT API DECLARATION
81
83#define PONCA_FITTING_IS_SIGNED(IS_SIGNED) \
84 \
85 PONCA_MULTIARCH inline constexpr bool isSigned() { return IS_SIGNED; }
86
88#define PONCA_FITTING_DECLARE_INIT \
89 PONCA_FITTING_APIDOC_INIT \
90 PONCA_MULTIARCH inline void init();
91
93#define PONCA_FITTING_DECLARE_ADDNEIGHBOR \
94 PONCA_FITTING_APIDOC_ADDNEIGHBOR \
95 PONCA_MULTIARCH inline void addLocalNeighbor(Scalar w, const VectorType& localQ, const DataPoint& attributes);
96
98#define PONCA_FITTING_DECLARE_ADDNEIGHBOR_DER \
99 PONCA_FITTING_APIDOC_ADDNEIGHBOR_DER \
100 PONCA_MULTIARCH inline void addLocalNeighbor(Scalar w, const VectorType& localQ, const DataPoint& attributes, \
101 ScalarArray& dw);
102
104#define PONCA_FITTING_DECLARE_FINALIZE \
105 PONCA_FITTING_APIDOC_FINALIZE \
106 PONCA_MULTIARCH inline FIT_RESULT finalize();
107
108#define PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE \
109 PONCA_FITTING_DECLARE_INIT \
110 PONCA_FITTING_DECLARE_ADDNEIGHBOR \
111 PONCA_FITTING_DECLARE_FINALIZE
112
113#define PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE \
114 PONCA_FITTING_DECLARE_INIT \
115 PONCA_FITTING_DECLARE_ADDNEIGHBOR_DER \
116 PONCA_FITTING_DECLARE_FINALIZE
117
118namespace Ponca
119{
121 template <typename T, typename = void>
122 struct hasFirstFundamentalForm : std::false_type
123 {
124 };
125
126 template <typename T>
127 struct hasFirstFundamentalForm<T, std::void_t<decltype(std::declval<T>().firstFundamentalForm())>> : std::true_type
128 {
129 };
130
131} // namespace Ponca
132
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:122