/*
    PIP - Platform Independent Primitives
    Contains geo ellipsoid models
    Andrey Bychkov work.a.b@yandex.ru

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#include "piellipsoidmodel.h"


PIEllipsoidModel::PIEllipsoidModel() {
	a            = 0.0;
	flattening   = 0.0;
	eccentricity = 0.0;
	angVelocity  = 0.0;
}


PIEllipsoidModel PIEllipsoidModel::WGS84Ellipsoid() {
	PIEllipsoidModel v;
	v.a            = 6378137.0;
	v.flattening   = 0.335281066475e-2;
	v.eccentricity = 8.1819190842622e-2;
	v.angVelocity  = 7.292115e-5;
	return v;
}


PIEllipsoidModel PIEllipsoidModel::PZ90Ellipsoid() {
	PIEllipsoidModel v;
	v.a            = 6378136.0;
	v.flattening   = 3.35280373518e-3;
	v.eccentricity = 8.1819106432923e-2;
	v.angVelocity  = 7.292115e-5;
	return v;
}


PIEllipsoidModel PIEllipsoidModel::GPSEllipsoid() {
	PIEllipsoidModel v = WGS84Ellipsoid();
	v.angVelocity      = 7.2921151467e-5;
	return v;
}


PIEllipsoidModel PIEllipsoidModel::KrasovskiyEllipsoid() {
	PIEllipsoidModel v;
	v.a            = 6378245.0;
	v.flattening   = 1.0 / 298.3;
	v.eccentricity = sqrt(v.a * v.a - 6356863.0 * 6356863.0) / v.a;
	v.angVelocity  = 7.292115e-5;
	return v;
}
