hypothesis3D.h

Go to the documentation of this file.
00001 #ifndef MMVL_HYPOTHESIS_3D_HH
00002 #define MMVL_HYPOTHESIS_3D_HH
00003 
00004 #ifndef NDEBUG
00005 #include <iostream>
00006 #endif
00007 #include "hypothesis.h"
00008 #include "dice.h"
00009 
00010 namespace mimas{
00011   namespace hf{
00012 
00019     class hypothesis3D: public hypothesis{
00020     public:
00021       static float transX;
00022       static float transY;
00023       static float transZ;
00024       static float rotX;
00025       static float rotY;
00026       static float rotZ;
00027       
00028       float x;
00029       float y;
00030       float z;
00031       float Rx;
00032       float Ry;
00033       float Rz;
00034 
00035 #ifndef NDEBUG
00036       void debug(void) const
00037   {
00038     std::cerr<<"X: "  <<x<<std::endl;
00039     std::cerr<<"Y: "  <<y<<std::endl;
00040     std::cerr<<"Z: "  <<z<<std::endl;
00041     std::cerr<<"Rx: " <<Rx<<std::endl;
00042     std::cerr<<"Ry: " <<Ry<<std::endl;
00043     std::cerr<<"Rz: " <<Rz<<std::endl;
00044   }
00045 #endif
00046       
00047       hypothesis3D drift(void) const
00048       {
00049   return hypothesis3D(x + Dice::gaussian_random() * transX,
00050           y + Dice::gaussian_random() * transY,
00051           z + Dice::gaussian_random() * transZ,
00052           Rx + Dice::gaussian_random() * rotX,
00053           Ry + Dice::gaussian_random() * rotY,
00054           Rz + Dice::gaussian_random() * rotZ,
00055           weight);
00056       }
00057 
00058       hypothesis3D mean(const hypothesis3D &h)
00059       {
00060   if(h.weight != 0)
00061     {
00062       float coord1 = (x * weight  + h.x  * h.weight) / (weight + h.weight);
00063       float coord2 = (y * weight  + h.y  * h.weight) / (weight + h.weight);
00064       float coord3 = (z * weight  + h.z  * h.weight) / (weight + h.weight);
00065       float coord4 = (Rx * weight + h.Rx * h.weight) / (weight + h.weight);
00066       float coord5 = (Ry * weight + h.Ry * h.weight) / (weight + h.weight);
00067       float coord6 = (Rz * weight + h.Rz * h.weight) / (weight + h.weight);
00068   
00069       return hypothesis3D(coord1,
00070         coord2,
00071         coord3,
00072         coord4,
00073         coord5,
00074         coord6,
00075         weight + h.weight
00076         );
00077     }
00078   return *this;
00079       }
00080 
00081       float distance(const hypothesis3D &h)
00082       {
00083   /*
00084     !!!!!!! Research work can be carry out here
00085     this tuning is quite complicated and probably very important to do
00086     the underlying ideas I used is to vary by the same amount the dimension and
00087     to see how it influence the projection of the object (another problem is
00088     that the amount of variation is dependant with the value)
00089 
00090     Here I still haven't done any test but I consider that under a distance value of around 60
00091     the position is similar.
00092     For the angle 3 degree * 3 angle * 4 + 3 * 4mm * 2 horizontal_mvt + 15
00093   */
00094   float TO_DETERMINE_ANGLE = 5;
00095   float TO_DETERMINE_XY = 4;
00096     
00097   float angular_distance = sqrt((h.Rx - Rx) * (h.Rx - Rx) + (h.Ry - Ry) * (h.Ry - Ry));
00098   float XYpositional_distance = sqrt((h.x - x) * (h.x - x) + (h.y - y) * (h.y - y));
00099   float Zpositional_distance = h.z - z;
00100   return Zpositional_distance + XYpositional_distance * TO_DETERMINE_XY + angular_distance * TO_DETERMINE_ANGLE;
00101       }
00102       
00103       hypothesis3D(float x = 0, float y = 0, float z = 0, float Rx = 0, float Ry = 0, float Rz = 0, double weight = 1.)
00104   :hypothesis(weight),x(x), y(y), z(z), Rx(Rx), Ry(Ry), Rz(Rz){}
00105       
00106     };
00107   }
00108 } 
00109 #endif

[GNU/Linux] [Qt] [Mesa] [STL] [Lapack] [Boost] [Magick++] [Xalan-C and Xerces-C] [doxygen] [graphviz] [FFTW] [popt] [xine] [Gnuplot] [gnu-arch] [gcc] [gstreamer] [autoconf/automake/make] [freshmeat.net] [opensource.org] [sourceforge.net] [MMVL]
mimas 2.1 - Copyright Mon Oct 30 11:31:17 2006, Bala Amavasai, Stuart Meikle, Arul Selvan, Fabio Caparrelli, Jan Wedekind, Manuel Boissenin, ...