arBitFieldPattern.h
Go to the documentation of this file.
00001 /* ========================================================================
00002 * PROJECT: ARToolKitPlus
00003 * ========================================================================
00004 * This work is based on the original ARToolKit developed by
00005 *   Hirokazu Kato
00006 *   Mark Billinghurst
00007 *   HITLab, University of Washington, Seattle
00008 * http://www.hitl.washington.edu/artoolkit/
00009 *
00010 * Copyright of the derived and new portions of this work
00011 *     (C) 2006 Graz University of Technology
00012 *
00013 * This framework is free software; you can redistribute it and/or modify
00014 * it under the terms of the GNU General Public License as published by
00015 * the Free Software Foundation; either version 2 of the License, or
00016 * (at your option) any later version.
00017 *
00018 * This framework is distributed in the hope that it will be useful,
00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 * GNU General Public License for more details.
00022 *
00023 * You should have received a copy of the GNU General Public License
00024 * along with this framework; if not, write to the Free Software
00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 *
00027 * For further information please contact 
00028 *   Dieter Schmalstieg
00029 *   <schmalstieg@icg.tu-graz.ac.at>
00030 *   Graz University of Technology, 
00031 *   Institut for Computer Graphics and Vision,
00032 *   Inffeldgasse 16a, 8010 Graz, Austria.
00033 * ========================================================================
00034 ** @author   Daniel Wagner
00035 *
00036 * $Id: arBitFieldPattern.h 162 2006-04-19 21:28:10Z grabner $
00037 * @file
00038 * ======================================================================== */
00039 
00040 
00041 #ifndef __ARBITFIELDPATTERN_HEADERFILE__
00042 #define __ARBITFIELDPATTERN_HEADERFILE__
00043 
00044 
00045 namespace ARToolKitPlus {
00046 
00047         enum {
00048                 // size of the marker images
00049                 idPattWidth = 6,
00050                 idPattHeight = 6,
00051 
00052                 // number of bits we can use for marker id
00053                 idBits = 9,
00054                 idMask = (1<<idBits) - 1,
00055                 idMax = (1<<idBits) - 1,
00056 
00057                 pattBits = 4*idBits
00058         };
00059 
00060         // we only use __int64 under windows.
00061         // have to use unsigned long long othersie...
00062 #if defined(_MSC_VER) || defined(_WIN32_WCE)
00063         typedef __int64 IDPATTERN;
00064         const IDPATTERN bchMask = 0x8f80b8750;
00065 #else
00066         typedef unsigned long long IDPATTERN;
00067         const IDPATTERN bchMask = 0x8f80b8750ll;
00068 #endif
00069 
00070         const IDPATTERN xorMask0 = 0x0027;
00071         const IDPATTERN xorMask1 = 0x014e;
00072         const IDPATTERN xorMask2 = 0x0109;
00073         const IDPATTERN xorMask3 = 0x00db;
00074 
00075         const int posMask0 = 0;
00076         const int posMask1 = idBits;
00077         const int posMask2 = 2*idBits;
00078         const int posMask3 = 3*idBits;
00079 
00080         // full mask that is used to xor raw pattern image
00081         const IDPATTERN fullMask = (xorMask0<<posMask0) | (xorMask1<<posMask1) | (xorMask2<<posMask2) | (xorMask3<<posMask3);
00082 
00083 
00084         const unsigned int bchBits = 12;
00085         const unsigned int idMaxBCH = (1<<bchBits) - 1;
00086 
00087         // array with indices for 90° CW rotated grid
00088         const int rotate90[] = {
00089                 30, 24, 18, 12,  6,  0,
00090                 31, 25, 19, 13,  7,  1,
00091                 32, 26, 20, 14,  8,  2,
00092                 33, 27, 21, 15,  9,  3,
00093                 34, 28, 22, 16, 10,  4,
00094                 35, 29, 23, 17, 11,  5 
00095         };
00096 
00097 
00098         // some internal methods. primarily needed for
00099         // marker printing, etc.
00100         //
00101         static void generatePatternSimple(int nID, IDPATTERN& nPattern);
00102 
00103         static void generatePatternBCH(int nID, IDPATTERN& nPattern);
00104 
00105         // static void setBit(IDPATTERN& pat, int which);
00106 
00107         static bool isBitSet(IDPATTERN pat, int which);
00108 
00109 
00110 }  // namespace ARToolKitPlus
00111 
00112 
00113 #endif //__ARBITFIELDPATTERN_HEADERFILE__


tuw_artoolkitplus
Author(s): Markus Bader
autogenerated on Sun May 29 2016 02:50:12