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