core/vcsl/vcsl_spheroid.cxx
Go to the documentation of this file.
00001 // This is core/vcsl/vcsl_spheroid.cxx
00002 #include "vcsl_spheroid.h"
00003 #include <vcl_cmath.h> // for sqrt()
00004 #include <vcl_cassert.h>
00005 
00006 //---------------------------------------------------------------------------
00007 // Set from a standard spheroid
00008 //---------------------------------------------------------------------------
00009 void vcsl_spheroid::set_from_std(const vcsl_std_spheroid new_std_spheroid)
00010 {
00011   switch (new_std_spheroid)
00012   {
00013    case airy_1830:
00014     a_=6377563.396;
00015     b_=6356256.910;
00016     break;
00017    case australian_national:
00018    case south_american_1969:
00019     a_=6378160;
00020     b_=6356774.7192;
00021     break;
00022    case bessel_1841:
00023     a_=6377397.155;
00024     b_=6356078.9629;
00025     break;
00026    case clarke_1866:
00027     a_=6378206.4;
00028     b_=6356583.8;
00029     break;
00030    case clarke_1880:
00031     a_=6378249.145;
00032     b_=6356514.8696;
00033     break;
00034    case everest_1830:
00035     a_=6377276.34518;
00036     b_=6356075.41511;
00037     break;
00038    case grs_1980:
00039     a_=6378137;
00040     b_=6356752.3141;
00041     break;
00042    case international:
00043     a_=6378388;
00044     b_=6356911.9462;
00045     break;
00046    case modified_airy:
00047     a_=6377340.189;
00048     b_=6356034.446;
00049     break;
00050    case modified_everest:
00051     a_=6377304.063;
00052     b_=6356103.039;
00053     break;
00054    case wgs_1972:
00055     a_=6378135;
00056     b_=6356750.5;
00057     break;
00058    case wgs_1984:
00059     a_=6378137;
00060     b_=6356752.3142;
00061     break;
00062    default:
00063     assert(!"impossible");
00064   }
00065 
00066   f_=(a_-b_)/a_;
00067   e_=vcl_sqrt(2*f_-f_*f_);
00068 }
00069 
00070 //---------------------------------------------------------------------------
00071 // Is `this' equal to `other' ?
00072 //---------------------------------------------------------------------------
00073 bool vcsl_spheroid::operator==(const vcsl_spheroid &other) const
00074 {
00075   if (this==&other)
00076     return true;
00077   else
00078     return a_==other.a_ && b_==other.b_ && e_==other.e_ && f_==other.f_;
00079 }
00080 
00081 //---------------------------------------------------------------------------
00082 // Assignment
00083 //---------------------------------------------------------------------------
00084 vcsl_spheroid &vcsl_spheroid::operator=(const vcsl_spheroid &other)
00085 {
00086   if (this!=&other)
00087   {
00088     a_=other.a_;
00089     b_=other.b_;
00090     e_=other.e_;
00091     f_=other.f_;
00092   }
00093   return *this;
00094 }