Colour sensors calibrated

Dependencies:   mbed-rtos mbed Servo QEI

Fork of ICRSEurobot13 by Thomas Branch

Committer:
xiaxia686
Date:
Fri Apr 12 20:59:18 2013 +0000
Revision:
46:adcd57a5e402
Parent:
15:9c5aaeda36dc
Colours Sensors fixed

Who changed what in which revision?

UserRevisionLine numberNew contents of line
madcowswe 15:9c5aaeda36dc 1 /*
madcowswe 15:9c5aaeda36dc 2 * Tiny Vector Matrix Library
madcowswe 15:9c5aaeda36dc 3 * Dense Vector Matrix Libary of Tiny size using Expression Templates
madcowswe 15:9c5aaeda36dc 4 *
madcowswe 15:9c5aaeda36dc 5 * Copyright (C) 2001 - 2007 Olaf Petzold <opetzold@users.sourceforge.net>
madcowswe 15:9c5aaeda36dc 6 *
madcowswe 15:9c5aaeda36dc 7 * This library is free software; you can redistribute it and/or
madcowswe 15:9c5aaeda36dc 8 * modify it under the terms of the GNU Lesser General Public
madcowswe 15:9c5aaeda36dc 9 * License as published by the Free Software Foundation; either
madcowswe 15:9c5aaeda36dc 10 * version 2.1 of the License, or (at your option) any later version.
madcowswe 15:9c5aaeda36dc 11 *
madcowswe 15:9c5aaeda36dc 12 * This library is distributed in the hope that it will be useful,
madcowswe 15:9c5aaeda36dc 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
madcowswe 15:9c5aaeda36dc 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
madcowswe 15:9c5aaeda36dc 15 * Lesser General Public License for more details.
madcowswe 15:9c5aaeda36dc 16 *
madcowswe 15:9c5aaeda36dc 17 * You should have received a copy of the GNU Lesser General Public
madcowswe 15:9c5aaeda36dc 18 * License along with this library; if not, write to the Free Software
madcowswe 15:9c5aaeda36dc 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
madcowswe 15:9c5aaeda36dc 20 *
madcowswe 15:9c5aaeda36dc 21 * $Id: VectorUnaryFunctions.h,v 1.13 2007-06-23 15:58:58 opetzold Exp $
madcowswe 15:9c5aaeda36dc 22 */
madcowswe 15:9c5aaeda36dc 23
madcowswe 15:9c5aaeda36dc 24 #ifndef TVMET_VECTOR_UNARY_FUNCTIONS_H
madcowswe 15:9c5aaeda36dc 25 #define TVMET_VECTOR_UNARY_FUNCTIONS_H
madcowswe 15:9c5aaeda36dc 26
madcowswe 15:9c5aaeda36dc 27 namespace tvmet {
madcowswe 15:9c5aaeda36dc 28
madcowswe 15:9c5aaeda36dc 29
madcowswe 15:9c5aaeda36dc 30 /*********************************************************
madcowswe 15:9c5aaeda36dc 31 * PART I: DECLARATION
madcowswe 15:9c5aaeda36dc 32 *********************************************************/
madcowswe 15:9c5aaeda36dc 33
madcowswe 15:9c5aaeda36dc 34 /*
madcowswe 15:9c5aaeda36dc 35 * unary_function(Vector<T, Sz>)
madcowswe 15:9c5aaeda36dc 36 */
madcowswe 15:9c5aaeda36dc 37 #define TVMET_DECLARE_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 38 template<class T, std::size_t Sz> \
madcowswe 15:9c5aaeda36dc 39 XprVector< \
madcowswe 15:9c5aaeda36dc 40 XprUnOp< \
madcowswe 15:9c5aaeda36dc 41 Fcnl_##NAME<T>, \
madcowswe 15:9c5aaeda36dc 42 VectorConstReference<T, Sz> \
madcowswe 15:9c5aaeda36dc 43 >, \
madcowswe 15:9c5aaeda36dc 44 Sz \
madcowswe 15:9c5aaeda36dc 45 > \
madcowswe 15:9c5aaeda36dc 46 NAME(const Vector<T, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;
madcowswe 15:9c5aaeda36dc 47
madcowswe 15:9c5aaeda36dc 48 TVMET_DECLARE_MACRO(abs)
madcowswe 15:9c5aaeda36dc 49 TVMET_DECLARE_MACRO(cbrt)
madcowswe 15:9c5aaeda36dc 50 TVMET_DECLARE_MACRO(ceil)
madcowswe 15:9c5aaeda36dc 51 TVMET_DECLARE_MACRO(floor)
madcowswe 15:9c5aaeda36dc 52 TVMET_DECLARE_MACRO(rint)
madcowswe 15:9c5aaeda36dc 53 TVMET_DECLARE_MACRO(sin)
madcowswe 15:9c5aaeda36dc 54 TVMET_DECLARE_MACRO(cos)
madcowswe 15:9c5aaeda36dc 55 TVMET_DECLARE_MACRO(tan)
madcowswe 15:9c5aaeda36dc 56 TVMET_DECLARE_MACRO(sinh)
madcowswe 15:9c5aaeda36dc 57 TVMET_DECLARE_MACRO(cosh)
madcowswe 15:9c5aaeda36dc 58 TVMET_DECLARE_MACRO(tanh)
madcowswe 15:9c5aaeda36dc 59 TVMET_DECLARE_MACRO(asin)
madcowswe 15:9c5aaeda36dc 60 TVMET_DECLARE_MACRO(acos)
madcowswe 15:9c5aaeda36dc 61 TVMET_DECLARE_MACRO(atan)
madcowswe 15:9c5aaeda36dc 62 TVMET_DECLARE_MACRO(exp)
madcowswe 15:9c5aaeda36dc 63 TVMET_DECLARE_MACRO(log)
madcowswe 15:9c5aaeda36dc 64 TVMET_DECLARE_MACRO(log10)
madcowswe 15:9c5aaeda36dc 65 TVMET_DECLARE_MACRO(sqrt)
madcowswe 15:9c5aaeda36dc 66
madcowswe 15:9c5aaeda36dc 67 #if defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 68 TVMET_DECLARE_MACRO(asinh)
madcowswe 15:9c5aaeda36dc 69 TVMET_DECLARE_MACRO(acosh)
madcowswe 15:9c5aaeda36dc 70 TVMET_DECLARE_MACRO(atanh)
madcowswe 15:9c5aaeda36dc 71 TVMET_DECLARE_MACRO(expm1)
madcowswe 15:9c5aaeda36dc 72 TVMET_DECLARE_MACRO(log1p)
madcowswe 15:9c5aaeda36dc 73 TVMET_DECLARE_MACRO(erf)
madcowswe 15:9c5aaeda36dc 74 TVMET_DECLARE_MACRO(erfc)
madcowswe 15:9c5aaeda36dc 75 TVMET_DECLARE_MACRO(j0)
madcowswe 15:9c5aaeda36dc 76 TVMET_DECLARE_MACRO(j1)
madcowswe 15:9c5aaeda36dc 77 TVMET_DECLARE_MACRO(y0)
madcowswe 15:9c5aaeda36dc 78 TVMET_DECLARE_MACRO(y1)
madcowswe 15:9c5aaeda36dc 79 TVMET_DECLARE_MACRO(lgamma)
madcowswe 15:9c5aaeda36dc 80 /** \todo isnan etc. - default return is only an int! */
madcowswe 15:9c5aaeda36dc 81
madcowswe 15:9c5aaeda36dc 82 TVMET_DECLARE_MACRO(finite)
madcowswe 15:9c5aaeda36dc 83 #endif // defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 84
madcowswe 15:9c5aaeda36dc 85 #undef TVMET_DECLARE_MACRO
madcowswe 15:9c5aaeda36dc 86
madcowswe 15:9c5aaeda36dc 87
madcowswe 15:9c5aaeda36dc 88 /*
madcowswe 15:9c5aaeda36dc 89 * unary_function(Vector<std::complex<T>, Sz>)
madcowswe 15:9c5aaeda36dc 90 */
madcowswe 15:9c5aaeda36dc 91 #if defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 92 #define TVMET_DECLARE_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 93 template<class T, std::size_t Sz> \
madcowswe 15:9c5aaeda36dc 94 XprVector< \
madcowswe 15:9c5aaeda36dc 95 XprUnOp< \
madcowswe 15:9c5aaeda36dc 96 Fcnl_##NAME< std::complex<T> >, \
madcowswe 15:9c5aaeda36dc 97 VectorConstReference<std::complex<T>, Sz> \
madcowswe 15:9c5aaeda36dc 98 >, \
madcowswe 15:9c5aaeda36dc 99 Sz \
madcowswe 15:9c5aaeda36dc 100 > \
madcowswe 15:9c5aaeda36dc 101 NAME(const Vector<std::complex<T>, Sz>& rhs) TVMET_CXX_ALWAYS_INLINE;
madcowswe 15:9c5aaeda36dc 102
madcowswe 15:9c5aaeda36dc 103 TVMET_DECLARE_MACRO(real)
madcowswe 15:9c5aaeda36dc 104 TVMET_DECLARE_MACRO(imag)
madcowswe 15:9c5aaeda36dc 105 TVMET_DECLARE_MACRO(arg)
madcowswe 15:9c5aaeda36dc 106 TVMET_DECLARE_MACRO(norm)
madcowswe 15:9c5aaeda36dc 107 TVMET_DECLARE_MACRO(conj)
madcowswe 15:9c5aaeda36dc 108
madcowswe 15:9c5aaeda36dc 109 #undef TVMET_DECLARE_MACRO
madcowswe 15:9c5aaeda36dc 110
madcowswe 15:9c5aaeda36dc 111 #endif // defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 112
madcowswe 15:9c5aaeda36dc 113
madcowswe 15:9c5aaeda36dc 114 /*********************************************************
madcowswe 15:9c5aaeda36dc 115 * PART II: IMPLEMENTATION
madcowswe 15:9c5aaeda36dc 116 *********************************************************/
madcowswe 15:9c5aaeda36dc 117
madcowswe 15:9c5aaeda36dc 118
madcowswe 15:9c5aaeda36dc 119 /*
madcowswe 15:9c5aaeda36dc 120 * unary_function(Vector<T, Sz>)
madcowswe 15:9c5aaeda36dc 121 */
madcowswe 15:9c5aaeda36dc 122 #define TVMET_IMPLEMENT_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 123 template<class T, std::size_t Sz> \
madcowswe 15:9c5aaeda36dc 124 inline \
madcowswe 15:9c5aaeda36dc 125 XprVector< \
madcowswe 15:9c5aaeda36dc 126 XprUnOp< \
madcowswe 15:9c5aaeda36dc 127 Fcnl_##NAME<T>, \
madcowswe 15:9c5aaeda36dc 128 VectorConstReference<T, Sz> \
madcowswe 15:9c5aaeda36dc 129 >, \
madcowswe 15:9c5aaeda36dc 130 Sz \
madcowswe 15:9c5aaeda36dc 131 > \
madcowswe 15:9c5aaeda36dc 132 NAME(const Vector<T, Sz>& rhs) { \
madcowswe 15:9c5aaeda36dc 133 typedef XprUnOp< \
madcowswe 15:9c5aaeda36dc 134 Fcnl_##NAME<T>, \
madcowswe 15:9c5aaeda36dc 135 VectorConstReference<T, Sz> \
madcowswe 15:9c5aaeda36dc 136 > expr_type; \
madcowswe 15:9c5aaeda36dc 137 return XprVector<expr_type, Sz>(expr_type(rhs.const_ref())); \
madcowswe 15:9c5aaeda36dc 138 }
madcowswe 15:9c5aaeda36dc 139
madcowswe 15:9c5aaeda36dc 140 TVMET_IMPLEMENT_MACRO(abs)
madcowswe 15:9c5aaeda36dc 141 TVMET_IMPLEMENT_MACRO(cbrt)
madcowswe 15:9c5aaeda36dc 142 TVMET_IMPLEMENT_MACRO(ceil)
madcowswe 15:9c5aaeda36dc 143 TVMET_IMPLEMENT_MACRO(floor)
madcowswe 15:9c5aaeda36dc 144 TVMET_IMPLEMENT_MACRO(rint)
madcowswe 15:9c5aaeda36dc 145 TVMET_IMPLEMENT_MACRO(sin)
madcowswe 15:9c5aaeda36dc 146 TVMET_IMPLEMENT_MACRO(cos)
madcowswe 15:9c5aaeda36dc 147 TVMET_IMPLEMENT_MACRO(tan)
madcowswe 15:9c5aaeda36dc 148 TVMET_IMPLEMENT_MACRO(sinh)
madcowswe 15:9c5aaeda36dc 149 TVMET_IMPLEMENT_MACRO(cosh)
madcowswe 15:9c5aaeda36dc 150 TVMET_IMPLEMENT_MACRO(tanh)
madcowswe 15:9c5aaeda36dc 151 TVMET_IMPLEMENT_MACRO(asin)
madcowswe 15:9c5aaeda36dc 152 TVMET_IMPLEMENT_MACRO(acos)
madcowswe 15:9c5aaeda36dc 153 TVMET_IMPLEMENT_MACRO(atan)
madcowswe 15:9c5aaeda36dc 154 TVMET_IMPLEMENT_MACRO(exp)
madcowswe 15:9c5aaeda36dc 155 TVMET_IMPLEMENT_MACRO(log)
madcowswe 15:9c5aaeda36dc 156 TVMET_IMPLEMENT_MACRO(log10)
madcowswe 15:9c5aaeda36dc 157 TVMET_IMPLEMENT_MACRO(sqrt)
madcowswe 15:9c5aaeda36dc 158
madcowswe 15:9c5aaeda36dc 159 #if defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 160 TVMET_IMPLEMENT_MACRO(asinh)
madcowswe 15:9c5aaeda36dc 161 TVMET_IMPLEMENT_MACRO(acosh)
madcowswe 15:9c5aaeda36dc 162 TVMET_IMPLEMENT_MACRO(atanh)
madcowswe 15:9c5aaeda36dc 163 TVMET_IMPLEMENT_MACRO(expm1)
madcowswe 15:9c5aaeda36dc 164 TVMET_IMPLEMENT_MACRO(log1p)
madcowswe 15:9c5aaeda36dc 165 TVMET_IMPLEMENT_MACRO(erf)
madcowswe 15:9c5aaeda36dc 166 TVMET_IMPLEMENT_MACRO(erfc)
madcowswe 15:9c5aaeda36dc 167 TVMET_IMPLEMENT_MACRO(j0)
madcowswe 15:9c5aaeda36dc 168 TVMET_IMPLEMENT_MACRO(j1)
madcowswe 15:9c5aaeda36dc 169 TVMET_IMPLEMENT_MACRO(y0)
madcowswe 15:9c5aaeda36dc 170 TVMET_IMPLEMENT_MACRO(y1)
madcowswe 15:9c5aaeda36dc 171 TVMET_IMPLEMENT_MACRO(lgamma)
madcowswe 15:9c5aaeda36dc 172 /** \todo isnan etc. - default return is only an int! */
madcowswe 15:9c5aaeda36dc 173
madcowswe 15:9c5aaeda36dc 174 TVMET_IMPLEMENT_MACRO(finite)
madcowswe 15:9c5aaeda36dc 175 #endif // defined(TVMET_HAVE_IEEE_MATH)
madcowswe 15:9c5aaeda36dc 176
madcowswe 15:9c5aaeda36dc 177 #undef TVMET_IMPLEMENT_MACRO
madcowswe 15:9c5aaeda36dc 178
madcowswe 15:9c5aaeda36dc 179
madcowswe 15:9c5aaeda36dc 180 /*
madcowswe 15:9c5aaeda36dc 181 * unary_function(Vector<std::complex<T>, Sz>)
madcowswe 15:9c5aaeda36dc 182 */
madcowswe 15:9c5aaeda36dc 183 #if defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 184 #define TVMET_IMPLEMENT_MACRO(NAME) \
madcowswe 15:9c5aaeda36dc 185 template<class T, std::size_t Sz> \
madcowswe 15:9c5aaeda36dc 186 inline \
madcowswe 15:9c5aaeda36dc 187 XprVector< \
madcowswe 15:9c5aaeda36dc 188 XprUnOp< \
madcowswe 15:9c5aaeda36dc 189 Fcnl_##NAME< std::complex<T> >, \
madcowswe 15:9c5aaeda36dc 190 VectorConstReference<std::complex<T>, Sz> \
madcowswe 15:9c5aaeda36dc 191 >, \
madcowswe 15:9c5aaeda36dc 192 Sz \
madcowswe 15:9c5aaeda36dc 193 > \
madcowswe 15:9c5aaeda36dc 194 NAME(const Vector<std::complex<T>, Sz>& rhs) { \
madcowswe 15:9c5aaeda36dc 195 typedef XprUnOp< \
madcowswe 15:9c5aaeda36dc 196 Fcnl_##NAME< std::complex<T> >, \
madcowswe 15:9c5aaeda36dc 197 VectorConstReference<std::complex<T>, Sz> \
madcowswe 15:9c5aaeda36dc 198 > expr_type; \
madcowswe 15:9c5aaeda36dc 199 return XprVector<expr_type, Sz>(expr_type(rhs.const_ref())); \
madcowswe 15:9c5aaeda36dc 200 }
madcowswe 15:9c5aaeda36dc 201
madcowswe 15:9c5aaeda36dc 202 TVMET_IMPLEMENT_MACRO(real)
madcowswe 15:9c5aaeda36dc 203 TVMET_IMPLEMENT_MACRO(imag)
madcowswe 15:9c5aaeda36dc 204 TVMET_IMPLEMENT_MACRO(arg)
madcowswe 15:9c5aaeda36dc 205 TVMET_IMPLEMENT_MACRO(norm)
madcowswe 15:9c5aaeda36dc 206 TVMET_IMPLEMENT_MACRO(conj)
madcowswe 15:9c5aaeda36dc 207
madcowswe 15:9c5aaeda36dc 208 #undef TVMET_IMPLEMENT_MACRO
madcowswe 15:9c5aaeda36dc 209
madcowswe 15:9c5aaeda36dc 210 #endif // defined(TVMET_HAVE_COMPLEX)
madcowswe 15:9c5aaeda36dc 211
madcowswe 15:9c5aaeda36dc 212
madcowswe 15:9c5aaeda36dc 213 } // namespace tvmet
madcowswe 15:9c5aaeda36dc 214
madcowswe 15:9c5aaeda36dc 215 #endif // TVMET_VECTOR_UNARY_FUNCTIONS_H
madcowswe 15:9c5aaeda36dc 216
madcowswe 15:9c5aaeda36dc 217 // Local Variables:
madcowswe 15:9c5aaeda36dc 218 // mode:C++
madcowswe 15:9c5aaeda36dc 219 // tab-width:8
madcowswe 15:9c5aaeda36dc 220 // End: