46 #if defined __INTEL_COMPILER
47 #pragma warning disable 2196 2536 279
55 #pragma warning (disable: 4018 4244 4267 4521 4251 4661 4305 4503 4146)
58 #ifndef _USE_MATH_DEFINES
59 #define _USE_MATH_DEFINES
68 #include <boost/cstdint.hpp>
69 #include <boost/smart_ptr/shared_ptr.hpp>
77 #include <pcl/pcl_config.h>
83 #if defined(__has_cpp_attribute) && __has_cpp_attribute(deprecated) && !defined(__CUDACC__)
84 #define PCL_DEPRECATED(message) [[deprecated(message)]]
85 #elif defined(__GNUC__) || defined(__clang__)
86 #define PCL_DEPRECATED(message) __attribute__((deprecated(message)))
87 #elif defined(_MSC_VER)
91 #define PCL_DEPRECATED(message)
93 #warning "You need to implement PCL_DEPRECATED for this compiler"
94 #define PCL_DEPRECATED(message)
107 template <
typename T>
110 using uint8_t
PCL_DEPRECATED(
"use std::uint8_t instead of pcl::uint8_t") = std::uint8_t;
111 using int8_t
PCL_DEPRECATED(
"use std::int8_t instead of pcl::int8_t") = std::int8_t;
112 using uint16_t
PCL_DEPRECATED(
"use std::uint16_t instead of pcl::uint16_t") = std::uint16_t;
113 using int16_t
PCL_DEPRECATED(
"use std::uint16_t instead of pcl::int16_t") = std::int16_t;
114 using uint32_t
PCL_DEPRECATED(
"use std::uint32_t instead of pcl::uint32_t") = std::uint32_t;
115 using int32_t
PCL_DEPRECATED(
"use std::int32_t instead of pcl::int32_t") = std::int32_t;
116 using uint64_t
PCL_DEPRECATED(
"use std::uint64_t instead of pcl::uint64_t") = std::uint64_t;
117 using int64_t
PCL_DEPRECATED(
"use std::int64_t instead of pcl::int64_t") = std::int64_t;
118 using int_fast16_t
PCL_DEPRECATED(
"use std::int_fast16_t instead of pcl::int_fast16_t") = std::int_fast16_t;
121 #if defined _WIN32 && defined _MSC_VER
125 #ifndef _MATH_DEFINES_DEFINED
126 #define _MATH_DEFINES_DEFINED
128 #define M_E 2.71828182845904523536 // e
129 #define M_LOG2E 1.44269504088896340736 // log2(e)
130 #define M_LOG10E 0.434294481903251827651 // log10(e)
131 #define M_LN2 0.693147180559945309417 // ln(2)
132 #define M_LN10 2.30258509299404568402 // ln(10)
133 #define M_PI 3.14159265358979323846 // pi
134 #define M_PI_2 1.57079632679489661923 // pi/2
135 #define M_PI_4 0.785398163397448309616 // pi/4
136 #define M_1_PI 0.318309886183790671538 // 1/pi
137 #define M_2_PI 0.636619772367581343076 // 2/pi
138 #define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
139 #define M_SQRT2 1.41421356237309504880 // sqrt(2)
140 #define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
148 # define __PRETTY_FUNCTION__ __FUNCTION__
149 # define __func__ __FUNCTION__
151 #endif //defined _WIN32 && defined _MSC_VER
156 bool
pcl_isnan (T&& x) {
return std::isnan (std::forward<T> (x)); }
160 bool
pcl_isfinite (T&& x) {
return std::isfinite (std::forward<T> (x)); }
164 bool
pcl_isinf (T&& x) {
return std::isinf (std::forward<T> (x)); }
168 #define DEG2RAD(x) ((x)*0.017453293)
172 #define RAD2DEG(x) ((x)*57.29578)
177 #define PCL_LINEAR_VERSION(major,minor,patch) ((major)<<16|(minor)<<8|(patch))
186 return (number < 0.0 ? std::ceil (number - 0.5) : std::floor (number + 0.5));
191 return (number < 0.0f ? std::ceil (number - 0.5f) : std::floor (number + 0.5f));
195 #define pcl_lrint(x) (lrint(static_cast<double> (x)))
196 #define pcl_lrintf(x) (lrintf(static_cast<float> (x)))
198 #define pcl_lrint(x) (static_cast<long int>(pcl_round(x)))
199 #define pcl_lrintf(x) (static_cast<long int>(pcl_round(x)))
203 #define pcl_sleep(x) Sleep(1000*(x))
205 #define pcl_sleep(x) sleep(x)
210 #s << " = " << (s) << std::flush
214 #s << " = " << (s) << "\n"
218 #s << " = " << (s) << ", " << std::flush
222 #s << " = " << (s) << " " << std::flush
226 #s << " = " << RAD2DEG(s) << "deg" << std::flush
230 #s << " = " << RAD2DEG(s) << "deg\n"
234 #s << " = " << RAD2DEG(s) << "deg, " << std::flush
238 #s << " = " << RAD2DEG(s) << "deg " << std::flush
242 std::fixed << s << std::resetiosflags(std::ios_base::fixed)
245 #define ERASE_STRUCT(var) memset(&var, 0, sizeof(var))
249 #define ERASE_ARRAY(var, size) memset(var, 0, size*sizeof(*var))
253 #define SET_ARRAY(var, value, size) { for (decltype(size) i = 0; i < size; ++i) var[i]=value; }
258 #define PCL_EXTERN_C extern "C"
264 #if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
265 #ifdef PCLAPI_EXPORTS
266 #define PCL_EXPORTS __declspec(dllexport)
274 #if defined WIN32 || defined _WIN32
275 #define PCL_CDECL __cdecl
276 #define PCL_STDCALL __stdcall
283 #define PCLAPI(rettype) PCL_EXTERN_C PCL_EXPORTS rettype PCL_CDECL
287 #if (defined (__GNUC__) || defined(__clang__))
288 #define PCL_PRAGMA(x) _Pragma (#x)
290 #define PCL_PRAGMA(x) __pragma (#x)
296 #if (defined (__GNUC__) || defined(__clang__))
297 #define PCL_PRAGMA_WARNING(x) PCL_PRAGMA (GCC warning x)
299 #define PCL_PRAGMA_WARNING(x) PCL_PRAGMA (warning (x))
301 #define PCL_PRAGMA_WARNING
305 #ifndef __has_extension
306 #define __has_extension(x) 0 // Compatibility with pre-3.0 compilers.
309 #if defined (__GNUC__) || defined (__PGI) || defined (__IBMCPP__) || defined (__SUNPRO_CC)
310 #define PCL_ALIGN(alignment) __attribute__((aligned(alignment)))
311 #elif defined (_MSC_VER)
312 #define PCL_ALIGN(alignment) __declspec(align(alignment))
314 #error Alignment not supported on your platform
317 #if defined(__GLIBC__) && PCL_LINEAR_VERSION(__GLIBC__,__GLIBC_MINOR__,0)>PCL_LINEAR_VERSION(2,8,0)
318 #define GLIBC_MALLOC_ALIGNED 1
320 #define GLIBC_MALLOC_ALIGNED 0
323 #if defined(__FreeBSD__) && !defined(__arm__) && !defined(__mips__)
324 #define FREEBSD_MALLOC_ALIGNED 1
326 #define FREEBSD_MALLOC_ALIGNED 0
329 #if defined(__APPLE__) || defined(_WIN64) || GLIBC_MALLOC_ALIGNED || FREEBSD_MALLOC_ALIGNED
330 #define MALLOC_ALIGNED 1
333 #if defined (HAVE_MM_MALLOC)
335 #if defined(__INTEL_COMPILER)
338 #include <mm_malloc.h>
346 #if defined (MALLOC_ALIGNED)
347 ptr = std::malloc (size);
348 #elif defined (HAVE_POSIX_MEMALIGN)
349 if (posix_memalign (&ptr, 16, size))
351 #elif defined (HAVE_MM_MALLOC)
352 ptr = _mm_malloc (size, 16);
353 #elif defined (_MSC_VER)
354 ptr = _aligned_malloc (size, 16);
355 #elif defined (ANDROID)
356 ptr = memalign (16, size);
358 #error aligned_malloc not supported on your platform
367 #if defined (MALLOC_ALIGNED) || defined (HAVE_POSIX_MEMALIGN)
369 #elif defined (HAVE_MM_MALLOC)
371 #elif defined (_MSC_VER)
373 #elif defined (ANDROID)
376 #error aligned_free not supported on your platform
389 #define PCL_MAKE_ALIGNED_OPERATOR_NEW \
390 EIGEN_MAKE_ALIGNED_OPERATOR_NEW \
391 using _custom_allocator_type_trait = void;
398 #if (__cplusplus >= 201703L) || (defined(_MSC_VER) && (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703L))
399 #define PCL_FALLTHROUGH [[fallthrough]];
400 #elif defined(__clang__)
401 #define PCL_FALLTHROUGH [[clang::fallthrough]];
402 #elif defined(__GNUC__) && (__GNUC__ >= 7)
403 #define PCL_FALLTHROUGH [[gnu::fallthrough]];
405 #define PCL_FALLTHROUGH
408 #if (__cplusplus >= 201703L) || (defined(_MSC_VER) && (_MSC_VER >= 1911) && (_MSVC_LANG >= 201703L))
409 #define PCL_NODISCARD [[nodiscard]]
410 #elif defined(__clang__) && (PCL_LINEAR_VERSION(__clang_major__, __clang_minor__, 0) >= PCL_LINEAR_VERSION(3, 9, 0))
411 #define PCL_NODISCARD [[clang::warn_unused_result]]
412 #elif defined(__GNUC__)
413 #define PCL_NODISCARD [[gnu::warn_unused_result]]
415 #define PCL_NODISCARD