head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.38; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.55; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.01; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.57; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# magvar.cxx

    00001 // magvar.cxx -- magnetic variation wrapper class
    00002 //
    00003 // Written by Curtis Olson, started July 2000.
    00004 //
    00005 // Copyright (C) 2000  Curtis L. Olson  - curt@@flightgear.org
    00006 //
    00007 // This program is free software; you can redistribute it and/or
    00008 // modify it under the terms of the GNU General Public License as
    00009 // published by the Free Software Foundation; either version 2 of the
    00010 // License, or (at your option) any later version.
    00011 //
    00012 // This program is distributed in the hope that it will be useful, but
    00013 // WITHOUT ANY WARRANTY; without even the implied warranty of
    00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00015 // General Public License for more details.
    00016 //
    00017 // You should have received a copy of the GNU General Public License
    00018 // along with this program; if not, write to the Free Software
    00019 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00020 //
    00021 // $Id: magvar.cxx,v 1.11 2002/04/25 14:55:40 david Exp $
    00022
    00023
    00024 #include <math.h>
    00025
    00026 #include <simgear/magvar/magvar.hxx>
    00027
    00028 #include "coremag.hxx"
    00029 #include "magvar.hxx"
    00030
    00031
    00032 SGMagVar::SGMagVar()
    00033   : magvar(0.0),
    00034     magdip(0.0)
    00035 {
    00036 }
    00037
    00038 SGMagVar::~SGMagVar() {
    00039 }
    00040
    00041
    00042 void SGMagVar::update( double lon, double lat, double alt_m, double jd ) {
    00043     // Calculate local magnetic variation
    00044     double field[6];
    00045     // cout << "alt_m = " << alt_m << endl;
    00046     magvar = calc_magvar( lat, lon, alt_m / 1000.0, (long)jd, field );
    00047     magdip = atan(field[5]/sqrt(field[3]*field[3]+field[4]*field[4]));
    00048 }
    00049
    00050
    00051 double sgGetMagVar( double lon, double lat, double alt_m, double jd ) {
    00052     // cout << "lat = " << lat << " lon = " << lon << " elev = " << alt_m
    00053     //      << " JD = " << jd << endl;
    00054
    00055     double field[6];
    00056     return calc_magvar( lat, lon, alt_m / 1000.0, (long)jd, field );
    00057 }

@ 1.3 log @Oops, try again. @ text @d66 1 a66 1