Point Cloud Library (PCL)
1.3.1
|
00001 /* 00002 * Software License Agreement (BSD License) 00003 * 00004 * Copyright (c) 2010, Willow Garage, Inc. 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * * Redistributions in binary form must reproduce the above 00014 * copyright notice, this list of conditions and the following 00015 * disclaimer in the documentation and/or other materials provided 00016 * with the distribution. 00017 * * Neither the name of Willow Garage, Inc. nor the names of its 00018 * contributors may be used to endorse or promote products derived 00019 * from this software without specific prior written permission. 00020 * 00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00022 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00023 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00024 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 00025 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 00026 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 00027 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00028 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00029 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 00030 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 00031 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00032 * POSSIBILITY OF SUCH DAMAGE. 00033 */ 00034 00035 #ifndef PCL_WIN32_MACROS_H_ 00036 #define PCL_WIN32_MACROS_H_ 00037 00038 #include <boost/cstdint.hpp> 00039 00040 namespace pcl 00041 { 00042 using boost::uint8_t; 00043 using boost::int8_t; 00044 using boost::int16_t; 00045 using boost::uint16_t; 00046 using boost::int32_t; 00047 using boost::uint32_t; 00048 using boost::int64_t; 00049 using boost::uint64_t; 00050 } 00051 00052 // MSCV doesn't have std::{isnan,isfinite} 00053 #if defined _WIN32 && defined _MSC_VER 00054 00055 // Stupid. This should be removed when all the PCL dependencies have min/max fixed. 00056 #ifndef NOMINMAX 00057 # define NOMINMAX 00058 #endif 00059 00060 # define pcl_isnan(x) _isnan(x) 00061 # define pcl_isfinite(x) (_finite(x) != 0) 00062 # define pcl_isinf(x) (_finite(x) == 0) 00063 00064 # define __PRETTY_FUNCTION__ __FUNCTION__ 00065 # define __func__ __FUNCTION__ 00066 00067 #elif ANDROID 00068 // Use the math.h macros 00069 # include <math.h> 00070 # define pcl_isnan(x) isnan(x) 00071 # define pcl_isfinite(x) isfinite(x) 00072 # define pcl_isinf(x) isinf(x) 00073 00074 #elif _GLIBCXX_USE_C99_MATH 00075 // Are the C++ cmath functions enabled? 00076 # include <cmath> 00077 # define pcl_isnan(x) std::isnan(x) 00078 # define pcl_isfinite(x) std::isfinite(x) 00079 # define pcl_isinf(x) std::isinf(x) 00080 00081 #elif __PATHCC__ 00082 # include <cmath> 00083 # include <stdio.h> 00084 template <typename T> int 00085 pcl_isnan (T &val) 00086 { 00087 return (val != val); 00088 } 00089 //# define pcl_isnan(x) std::isnan(x) 00090 # define pcl_isfinite(x) std::isfinite(x) 00091 # define pcl_isinf(x) std::isinf(x) 00092 00093 #else 00094 // Use the math.h macros 00095 # include <math.h> 00096 # define pcl_isnan(x) isnan(x) 00097 # define pcl_isfinite(x) isfinite(x) 00098 # define pcl_isinf(x) isinf(x) 00099 00100 #endif 00101 00102 // Windows doesn't like M_PI. 00103 #ifndef M_PI 00104 #define M_PI 3.14159265358979323846 00105 #endif 00106 00107 #ifndef M_E 00108 #define M_E 2.7182818284590452354 00109 #endif 00110 00111 #ifndef M_LN2 00112 #define M_LN2 0.693147180559945309417 00113 #endif 00114 00118 #include <math.h> 00119 __inline double pcl_round(double number) 00120 { 00121 return number < 0.0 ? ceil(number - 0.5) : floor(number + 0.5); 00122 } 00123 __inline float pcl_round(float number) 00124 { 00125 return number < 0.0f ? ceil(number - 0.5f) : floor(number + 0.5f); 00126 } 00127 00128 #define pcl_lrint(x) ((long int) pcl_round(x)) 00129 #define pcl_lrintf(x) ((long int) pcl_round(x)) 00130 00131 #ifdef WIN32 00132 #define pcl_sleep(x) Sleep(1000*(x)) 00133 #else 00134 #define pcl_sleep(x) sleep(x) 00135 #endif 00136 00137 #endif //#ifndef PCL_WIN32_MACROS_H_