working version with calibration done

Fork of Eurobot2013 by Oskar Weigl

Committer:
sv
Date:
Wed Nov 07 14:37:35 2012 +0000
Revision:
1:6799c07fe510
Preliminary copy of 2012 code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sv 1:6799c07fe510 1 /*
sv 1:6799c07fe510 2 * $Id: Identity.h,v 1.4 2006-11-21 18:43:09 opetzold Exp $
sv 1:6799c07fe510 3 */
sv 1:6799c07fe510 4
sv 1:6799c07fe510 5 #ifndef TVMET_XPR_IDENTITY_H
sv 1:6799c07fe510 6 #define TVMET_XPR_IDENTITY_H
sv 1:6799c07fe510 7
sv 1:6799c07fe510 8
sv 1:6799c07fe510 9 namespace tvmet {
sv 1:6799c07fe510 10
sv 1:6799c07fe510 11
sv 1:6799c07fe510 12 /**
sv 1:6799c07fe510 13 * \class XprIdentity Identity.h "tvmet/xpr/Identity.h"
sv 1:6799c07fe510 14 * \brief Expression for the identity matrix.
sv 1:6799c07fe510 15 *
sv 1:6799c07fe510 16 * This expression doesn't hold any other expression, it
sv 1:6799c07fe510 17 * simply returns 1 or 0 depends where the row and column
sv 1:6799c07fe510 18 * element excess is done.
sv 1:6799c07fe510 19 *
sv 1:6799c07fe510 20 * \since release 1.6.0
sv 1:6799c07fe510 21 * \sa identity
sv 1:6799c07fe510 22 */
sv 1:6799c07fe510 23 template<class T, std::size_t Rows, std::size_t Cols>
sv 1:6799c07fe510 24 struct XprIdentity
sv 1:6799c07fe510 25 : public TvmetBase< XprIdentity<T, Rows, Cols> >
sv 1:6799c07fe510 26 {
sv 1:6799c07fe510 27 XprIdentity& operator=(const XprIdentity&);
sv 1:6799c07fe510 28
sv 1:6799c07fe510 29 public:
sv 1:6799c07fe510 30 typedef T value_type;
sv 1:6799c07fe510 31
sv 1:6799c07fe510 32 public:
sv 1:6799c07fe510 33 /** Complexity counter. */
sv 1:6799c07fe510 34 enum {
sv 1:6799c07fe510 35 ops_assign = Rows * Cols,
sv 1:6799c07fe510 36 ops = ops_assign
sv 1:6799c07fe510 37 };
sv 1:6799c07fe510 38
sv 1:6799c07fe510 39 public:
sv 1:6799c07fe510 40 /** access by index. */
sv 1:6799c07fe510 41 value_type operator()(std::size_t i, std::size_t j) const {
sv 1:6799c07fe510 42 return i==j ? 1 : 0;
sv 1:6799c07fe510 43 }
sv 1:6799c07fe510 44
sv 1:6799c07fe510 45 public: // debugging Xpr parse tree
sv 1:6799c07fe510 46 void print_xpr(std::ostream& os, std::size_t l=0) const {
sv 1:6799c07fe510 47 os << IndentLevel(l++)
sv 1:6799c07fe510 48 << "XprIdentity[O="<< ops << ")]<"
sv 1:6799c07fe510 49 << std::endl;
sv 1:6799c07fe510 50 os << IndentLevel(l)
sv 1:6799c07fe510 51 << typeid(T).name() << ","
sv 1:6799c07fe510 52 << "R=" << Rows << ", C=" << Cols << std::endl;
sv 1:6799c07fe510 53 os << IndentLevel(--l) << ">"
sv 1:6799c07fe510 54 << ((l != 0) ? "," : "") << std::endl;
sv 1:6799c07fe510 55 }
sv 1:6799c07fe510 56 };
sv 1:6799c07fe510 57
sv 1:6799c07fe510 58
sv 1:6799c07fe510 59 } // namespace tvmet
sv 1:6799c07fe510 60
sv 1:6799c07fe510 61
sv 1:6799c07fe510 62 #endif // TVMET_XPR_IDENTITY_H
sv 1:6799c07fe510 63
sv 1:6799c07fe510 64
sv 1:6799c07fe510 65 // Local Variables:
sv 1:6799c07fe510 66 // mode:C++
sv 1:6799c07fe510 67 // tab-width:8
sv 1:6799c07fe510 68 // End: