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>
103 #if defined _WIN32 && defined _MSC_VER
107 #ifndef _MATH_DEFINES_DEFINED
108 #define _MATH_DEFINES_DEFINED
110 #define M_E 2.71828182845904523536 // e
111 #define M_LOG2E 1.44269504088896340736 // log2(e)
112 #define M_LOG10E 0.434294481903251827651 // log10(e)
113 #define M_LN2 0.693147180559945309417 // ln(2)
114 #define M_LN10 2.30258509299404568402 // ln(10)
115 #define M_PI 3.14159265358979323846 // pi
116 #define M_PI_2 1.57079632679489661923 // pi/2
117 #define M_PI_4 0.785398163397448309616 // pi/4
118 #define M_1_PI 0.318309886183790671538 // 1/pi
119 #define M_2_PI 0.636619772367581343076 // 2/pi
120 #define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
121 #define M_SQRT2 1.41421356237309504880 // sqrt(2)
122 #define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
130 # define __PRETTY_FUNCTION__ __FUNCTION__
131 # define __func__ __FUNCTION__
133 #endif //defined _WIN32 && defined _MSC_VER
137 [[deprecated(
"use std::isnan instead of pcl_isnan")]]
138 bool pcl_isnan (T&& x) {
return std::isnan (std::forward<T> (x)); }
141 [[deprecated(
"use std::isfinite instead of pcl_isfinite")]]
142 bool pcl_isfinite (T&& x) {
return std::isfinite (std::forward<T> (x)); }
145 [[deprecated(
"use std::isinf instead of pcl_isinf")]]
146 bool pcl_isinf (T&& x) {
return std::isinf (std::forward<T> (x)); }
150 #define DEG2RAD(x) ((x)*0.017453293)
154 #define RAD2DEG(x) ((x)*57.29578)
159 #define PCL_LINEAR_VERSION(major,minor,patch) ((major)<<16|(minor)<<8|(patch))
168 return (number < 0.0 ? std::ceil (number - 0.5) : std::floor (number + 0.5));
173 return (number < 0.0f ? std::ceil (number - 0.5f) : std::floor (number + 0.5f));
177 #define pcl_lrint(x) (lrint(static_cast<double> (x)))
178 #define pcl_lrintf(x) (lrintf(static_cast<float> (x)))
180 #define pcl_lrint(x) (static_cast<long int>(pcl_round(x)))
181 #define pcl_lrintf(x) (static_cast<long int>(pcl_round(x)))
185 #define pcl_sleep(x) Sleep(1000*(x))
187 #define pcl_sleep(x) sleep(x)
192 #s << " = " << (s) << std::flush
196 #s << " = " << (s) << "\n"
200 #s << " = " << (s) << ", " << std::flush
204 #s << " = " << (s) << " " << std::flush
208 #s << " = " << RAD2DEG(s) << "deg" << std::flush
212 #s << " = " << RAD2DEG(s) << "deg\n"
216 #s << " = " << RAD2DEG(s) << "deg, " << std::flush
220 #s << " = " << RAD2DEG(s) << "deg " << std::flush
224 std::fixed << s << std::resetiosflags(std::ios_base::fixed)
227 #define ERASE_STRUCT(var) memset(&var, 0, sizeof(var))
231 #define ERASE_ARRAY(var, size) memset(var, 0, size*sizeof(*var))
235 #define SET_ARRAY(var, value, size) { for (decltype(size) i = 0; i < size; ++i) var[i]=value; }
240 #define PCL_EXTERN_C extern "C"
246 #if defined WIN32 || defined _WIN32 || defined WINCE || defined __MINGW32__
247 #ifdef PCLAPI_EXPORTS
248 #define PCL_EXPORTS __declspec(dllexport)
256 #if defined WIN32 || defined _WIN32
257 #define PCL_CDECL __cdecl
258 #define PCL_STDCALL __stdcall
265 #define PCLAPI(rettype) PCL_EXTERN_C PCL_EXPORTS rettype PCL_CDECL
269 #if (defined (__GNUC__) || defined(__clang__))
270 #define PCL_PRAGMA(x) _Pragma (#x)
272 #define PCL_PRAGMA(x) __pragma (#x)
278 #if (defined (__GNUC__) || defined(__clang__))
279 #define PCL_PRAGMA_WARNING(x) PCL_PRAGMA (GCC warning x)
281 #define PCL_PRAGMA_WARNING(x) PCL_PRAGMA (warning (x))
283 #define PCL_PRAGMA_WARNING
287 #ifndef __has_extension
288 #define __has_extension(x) 0 // Compatibility with pre-3.0 compilers.
291 #if defined (__GNUC__) || defined (__PGI) || defined (__IBMCPP__) || defined (__SUNPRO_CC)
292 #define PCL_ALIGN(alignment) __attribute__((aligned(alignment)))
293 #elif defined (_MSC_VER)
294 #define PCL_ALIGN(alignment) __declspec(align(alignment))
296 #error Alignment not supported on your platform
299 #if defined(__GLIBC__) && PCL_LINEAR_VERSION(__GLIBC__,__GLIBC_MINOR__,0)>PCL_LINEAR_VERSION(2,8,0)
300 #define GLIBC_MALLOC_ALIGNED 1
302 #define GLIBC_MALLOC_ALIGNED 0
305 #if defined(__FreeBSD__) && !defined(__arm__) && !defined(__mips__)
306 #define FREEBSD_MALLOC_ALIGNED 1
308 #define FREEBSD_MALLOC_ALIGNED 0
311 #if defined(__APPLE__) || defined(_WIN64) || GLIBC_MALLOC_ALIGNED || FREEBSD_MALLOC_ALIGNED
312 #define MALLOC_ALIGNED 1
315 #if defined (HAVE_MM_MALLOC)
317 #if defined(__INTEL_COMPILER)
320 #include <mm_malloc.h>
328 #if defined (MALLOC_ALIGNED)
329 ptr = std::malloc (size);
330 #elif defined (HAVE_POSIX_MEMALIGN)
331 if (posix_memalign (&ptr, 16, size))
333 #elif defined (HAVE_MM_MALLOC)
334 ptr = _mm_malloc (size, 16);
335 #elif defined (_MSC_VER)
336 ptr = _aligned_malloc (size, 16);
337 #elif defined (ANDROID)
338 ptr = memalign (16, size);
340 #error aligned_malloc not supported on your platform
349 #if defined (MALLOC_ALIGNED) || defined (HAVE_POSIX_MEMALIGN)
351 #elif defined (HAVE_MM_MALLOC)
353 #elif defined (_MSC_VER)
355 #elif defined (ANDROID)
358 #error aligned_free not supported on your platform
371 #define PCL_MAKE_ALIGNED_OPERATOR_NEW \
372 EIGEN_MAKE_ALIGNED_OPERATOR_NEW \
373 using _custom_allocator_type_trait = void;
380 #if (__cplusplus >= 201703L) || (defined(_MSC_VER) && (_MSC_VER >= 1910) && (_MSVC_LANG >= 201703L))
381 #define PCL_FALLTHROUGH [[fallthrough]];
382 #elif defined(__clang__)
383 #define PCL_FALLTHROUGH [[clang::fallthrough]];
384 #elif defined(__GNUC__) && (__GNUC__ >= 7)
385 #define PCL_FALLTHROUGH [[gnu::fallthrough]];
387 #define PCL_FALLTHROUGH
390 #if (__cplusplus >= 201703L) || (defined(_MSC_VER) && (_MSC_VER >= 1911) && (_MSVC_LANG >= 201703L))
391 #define PCL_NODISCARD [[nodiscard]]
392 #elif defined(__clang__) && (PCL_LINEAR_VERSION(__clang_major__, __clang_minor__, 0) >= PCL_LINEAR_VERSION(3, 9, 0))
393 #define PCL_NODISCARD [[clang::warn_unused_result]]
394 #elif defined(__GNUC__)
395 #define PCL_NODISCARD [[gnu::warn_unused_result]]
397 #define PCL_NODISCARD