Go to the documentation of this file.00001 #ifndef Geom_LocalError_H
00002 #define Geom_LocalError_H
00003
00008 #include <cmath>
00009 #include <iosfwd>
00010
00011 class LocalError {
00012 public:
00013
00014 LocalError() : thexx(0), thexy(0), theyy(0) {}
00015
00016 LocalError( float xx, float xy, float yy) :
00017 thexx(xx), thexy(xy), theyy(yy) {}
00018
00019 float xx() const { return thexx;}
00020 float xy() const { return thexy;}
00021 float yy() const { return theyy;}
00022
00028 LocalError scale(float s) const {
00029 float s2 = s*s;
00030 return LocalError(s2*xx(), s2*xy(), s2*yy());
00031 }
00032
00034 LocalError rotate(float x, float y) const {
00035 return rotateCosSin( x, y, 1.f/(x*x+y*y) );
00036 }
00037
00039 LocalError rotate(float phi) const {
00040 return rotateCosSin( cos(phi), sin(phi));
00041 }
00042
00044 LocalError rotateCosSin( float c, float s, float mag2i=1.f) const {
00045 return LocalError( mag2i*( (c*c)*xx() + (s*s)*yy() - 2.f*(c*s)*xy()),
00046 mag2i*( (c*s)*(xx() - yy()) + (c*c-s*s)*xy()) ,
00047 mag2i*( (s*s)*xx() + (c*c)*yy() + 2.f*(c*s)*xy())
00048 );
00049 }
00050
00051 private:
00052
00053 float thexx;
00054 float thexy;
00055 float theyy;
00056
00057 };
00058
00059 std::ostream & operator<<( std::ostream& s, const LocalError& err) ;
00060
00061 #endif // LocalError_H