INTRODUCTION Overview Download and Install Quick Start Documentation Publications NONFRAMEWORK CODE Driver Interfaces Drivers Libraries Utilities FRAMEWORK CODE Interfaces Components Libraries Utilities Full Software Listings DEVELOPER Tutorials Examples Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
hydrolibs/hydronavutil/cov2d.h00001 #ifndef ORCANAVUTIL_COV2D_H 00002 #define ORCANAVUTIL_COV2D_H 00003 00004 #include <iostream> 00005 #include <assert.h> 00006 00007 namespace hydronavutil { 00008 00014 class Cov2d 00015 { 00016 00017 public: 00018 00019 Cov2d( double xx, double xy, double yy ) 00020 : xx_(xx),xy_(xy),yy_(yy) {} 00021 00022 double xx() const { return xx_; } 00023 double xy() const { return xy_; } 00024 double yy() const { return yy_; } 00025 00026 double &xx() { return xx_; } 00027 double &xy() { return xy_; } 00028 double &yy() { return yy_; } 00029 00030 // access like a matrix 00031 double m( int i, int j ) const 00032 { 00033 if ( i==0 && j==0 ) return xx_; 00034 else if ( i==0 && j==1 ) return xy_; 00035 else if ( i==1 && j==0 ) return xy_; 00036 else if ( i==1 && j==1 ) return yy_; 00037 else { assert( false&&"bad index" ); return 0; } 00038 } 00039 00040 private: 00041 00042 double xx_, xy_, yy_; 00043 00044 }; 00045 std::ostream &operator<<( std::ostream &s, const Cov2d &c ); 00046 00047 } 00048 00049 #endif |
Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)