Ponca  97e1aa5c56f0b8ca113a6b95d36cc3b5cde35a4e
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;
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;
57#define PONCA_FITTING_DECLARE_MATRIX_TYPE \
58public: \
59 using MatrixType = typename DataPoint::MatrixType;
62#define PONCA_FITTING_DECLARE_DEFAULT_DER_TYPES \
63public: \
64 using ScalarArray = typename Base::ScalarArray; \
65 using VectorArray = typename Base::VectorArray;
67// FIT API DOCUMENTATION
68#define PONCA_FITTING_APIDOC_SETWFUNC
71#define PONCA_FITTING_APIDOC_INIT
74#define PONCA_FITTING_APIDOC_ADDNEIGHBOR
75#define PONCA_FITTING_APIDOC_ADDNEIGHBOR_DER
76#define PONCA_FITTING_APIDOC_FINALIZE
79// FIT API DECLARATION
80
82#define PONCA_FITTING_IS_SIGNED(IS_SIGNED) \
83 \
84 PONCA_MULTIARCH inline constexpr bool isSigned() { return IS_SIGNED; }
85
87#define PONCA_FITTING_DECLARE_INIT \
88 PONCA_FITTING_APIDOC_INIT \
89 PONCA_MULTIARCH inline void init();
90
92#define PONCA_FITTING_DECLARE_ADDNEIGHBOR \
93 PONCA_FITTING_APIDOC_ADDNEIGHBOR \
94 PONCA_MULTIARCH inline void addLocalNeighbor(Scalar w, const VectorType& localQ, const DataPoint& attributes);
95
97#define PONCA_FITTING_DECLARE_ADDNEIGHBOR_DER \
98 PONCA_FITTING_APIDOC_ADDNEIGHBOR_DER \
99 PONCA_MULTIARCH inline void addLocalNeighbor(Scalar w, const VectorType& localQ, const DataPoint& attributes, \
100 ScalarArray& dw);
101
103#define PONCA_FITTING_DECLARE_FINALIZE \
104 PONCA_FITTING_APIDOC_FINALIZE \
105 PONCA_MULTIARCH inline FIT_RESULT finalize();
106
107#define PONCA_FITTING_DECLARE_INIT_ADD_FINALIZE \
108 PONCA_FITTING_DECLARE_INIT \
109 PONCA_FITTING_DECLARE_ADDNEIGHBOR \
110 PONCA_FITTING_DECLARE_FINALIZE
111
112#define PONCA_FITTING_DECLARE_INIT_ADDDER_FINALIZE \
113 PONCA_FITTING_DECLARE_INIT \
114 PONCA_FITTING_DECLARE_ADDNEIGHBOR_DER \
115 PONCA_FITTING_DECLARE_FINALIZE
116
117namespace Ponca
118{
120 template <typename T, typename = void>
121 struct hasFirstFundamentalForm : std::false_type
122 {
123 };
124
125 template <typename T>
126 struct hasFirstFundamentalForm<T, std::void_t<decltype(std::declval<T>().firstFundamentalForm())>> : std::true_type
127 {
128 };
129
130} // namespace Ponca
131
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