MIRA
Math.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
48 #ifndef _MIRA_MATH_H_
49 #define _MIRA_MATH_H_
50 
52 #include <cmath>
53 
54 #ifndef Q_MOC_RUN
55 // Include for boost::math::isnan, ...
56 #include <boost/math/special_functions/fpclassify.hpp>
57 // include round
58 #include <boost/math/special_functions/round.hpp>
59 // include constants
60 #include <boost/version.hpp>
61 #include <boost/math/constants/constants.hpp>
62 #endif
63 
65 namespace boost { namespace math { namespace constants {
66 
67 // boost >= 1.50 need three arguments for BOOST_DEFINE_MATH_CONSTANT
68 #if (BOOST_VERSION >= 105000)
69 
70 #if (BOOST_VERSION < 107400)
71 // pi/4
72 BOOST_DEFINE_MATH_CONSTANT(quarter_pi, 0.78539816339744830961566084581987572104929234984378, "0.78539816339744830961566084581987572104929234984378")
73 #endif
74 // pi / 180
75 BOOST_DEFINE_MATH_CONSTANT(pi_div_deg180, 0.017453292519943295769236907684886127134428718885417, "0.017453292519943295769236907684886127134428718885417")
76 // 180 / pi
77 BOOST_DEFINE_MATH_CONSTANT(deg180_div_pi, 57.295779513082320876798154814105170332405472466564, "57.295779513082320876798154814105170332405472466564")
78 #endif
79 
80 // boost < 1.50 need four arguments for BOOST_DEFINE_MATH_CONSTANT
81 #if (BOOST_VERSION < 105000)
82 // pi/2
83 BOOST_DEFINE_MATH_CONSTANT(half_pi, 1.5707963267948966192313216916397514420985846996876, 0, 0)
84 // pi/4
85 BOOST_DEFINE_MATH_CONSTANT(quarter_pi, 0.78539816339744830961566084581987572104929234984378, 0, 0)
86 // pi / 180
87 BOOST_DEFINE_MATH_CONSTANT(pi_div_deg180, 0.017453292519943295769236907684886127134428718885417, 0, 0)
88 // 180 / pi
89 BOOST_DEFINE_MATH_CONSTANT(deg180_div_pi, 57.295779513082320876798154814105170332405472466564, 0, 0)
90 #endif
91 
92 // for older boost versions define several useful constants that are part of boost >=1.46
93 #if (BOOST_VERSION < 104600)
94 BOOST_DEFINE_MATH_CONSTANT(two_pi, 6.2831853071795864769252867665590057683943388015061, 0, 0)
95 BOOST_DEFINE_MATH_CONSTANT(half_root_two, 0.70710678118654752440084436210484903928483593756084, 0, 0)
96 BOOST_DEFINE_MATH_CONSTANT(one_div_root_two, 0.70710678118654752440084436210484903928483593756084, 0, 0)
97 BOOST_DEFINE_MATH_CONSTANT(one_div_root_two_pi, 0.39894228040143267793994605993438186847585863095671, 0, 0)
98 #endif
99 
100 }}}
102 
103 // inject into our namespace
104 namespace mira {
105  using boost::math::round;
106  using namespace boost::math::constants;
107 }
108 
110 
111 #endif
Definition: SyncTimedRead.h:62
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67