root/juggler/branches/2.2/modules/gadgeteer/gadget/Filter/Position/PositionCalibrationFilter.h
| Revision 19729, 3.1 kB (checked in by patrick, 2 years ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /*************** <auto-copyright.pl BEGIN do not edit this line> ************** |
| 2 | * |
| 3 | * VR Juggler is (C) Copyright 1998-2007 by Iowa State University |
| 4 | * |
| 5 | * Original Authors: |
| 6 | * Allen Bierbaum, Christopher Just, |
| 7 | * Patrick Hartling, Kevin Meinert, |
| 8 | * Carolina Cruz-Neira, Albert Baker |
| 9 | * |
| 10 | * This library is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU Library General Public |
| 12 | * License as published by the Free Software Foundation; either |
| 13 | * version 2 of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This library is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 18 | * Library General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Library General Public |
| 21 | * License along with this library; if not, write to the |
| 22 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 23 | * Boston, MA 02111-1307, USA. |
| 24 | * |
| 25 | *************** <auto-copyright.pl END do not edit this line> ***************/ |
| 26 | |
| 27 | #ifndef _GADGET_POSITION_CALIBRATION_FILTER_H_ |
| 28 | #define _GADGET_POSITION_CALIBRATION_FILTER_H_ |
| 29 | |
| 30 | #include <gadget/gadgetConfig.h> |
| 31 | |
| 32 | #include <map> |
| 33 | #include <string> |
| 34 | #include <vector> |
| 35 | |
| 36 | #include <gmtl/Vec.h> |
| 37 | |
| 38 | #include <jccl/Config/ConfigElementPtr.h> |
| 39 | #include <gadget/Type/PositionData.h> |
| 40 | #include <gadget/Util/Debug.h> |
| 41 | #include <gadget/Filter/Position/PositionFilter.h> |
| 42 | |
| 43 | namespace gadget |
| 44 | { |
| 45 | /** \class PositionCalibrationFilter PositionCalibrationFilter.h gadget/Filter/Position/PositionCalibrationFilter.h |
| 46 | * |
| 47 | * A calibration filter that uses a calibration table to correct |
| 48 | * electromagnetic interference error from the tracker. |
| 49 | */ |
| 50 | class GADGET_CLASS_API PositionCalibrationFilter : public PositionFilter |
| 51 | { |
| 52 | public: |
| 53 | |
| 54 | /** |
| 55 | * Default Ctor |
| 56 | */ |
| 57 | PositionCalibrationFilter() |
| 58 | : mWMatrix(NULL) |
| 59 | {} |
| 60 | |
| 61 | ~PositionCalibrationFilter(); |
| 62 | |
| 63 | bool config(jccl::ConfigElementPtr e); |
| 64 | |
| 65 | void apply(std::vector< PositionData >& posSample); |
| 66 | |
| 67 | static std::string getElementType(); |
| 68 | |
| 69 | private: |
| 70 | |
| 71 | /** The calibration table. */ |
| 72 | std::vector< std::pair< gmtl::Vec3d, gmtl::Vec3d > > mTable; |
| 73 | |
| 74 | /** The name of the calibration file. */ |
| 75 | std::string mFileName; |
| 76 | |
| 77 | /** The "W" matrix. |
| 78 | * The "W" Matrix is an NxN matrix where N = mTable.size() |
| 79 | * It is composed of elements computed using the w(p) function: |
| 80 | * w[j](p) = sqrt( length(p - p[j]) + R*R ) |
| 81 | * where 10 <= R*R <= 1000. |
| 82 | * The matrix looks like: |
| 83 | * ( w[1](p[1]) w[2](p[1]) w[3](p[1]) ... w[N](p[1]) ) |
| 84 | * ( w[1](p[2]) w[2](p[2]) w[3](p[2]) ... w[N](p[2]) ) |
| 85 | * ( w[1](p[3]) w[2](p[3]) w[3](p[3]) ... w[N](p[3]) ) |
| 86 | * ( . ) |
| 87 | * ( . ) |
| 88 | * ( . ) |
| 89 | * ( w[1](p[N]) w[2](p[N]) w[3](p[N]) ... w[N](p[N]) ) |
| 90 | */ |
| 91 | double** mWMatrix; |
| 92 | |
| 93 | /** The Alpha Vector. */ |
| 94 | std::vector<gmtl::Vec3d> mAlphaVec; |
| 95 | }; |
| 96 | } |
| 97 | #endif |
Note: See TracBrowser for help on using the browser.
