1 // FGAIStorm - FGAIBase-derived class creates an AI thunderstorm or cloud
3 // Written by David Culp, started Feb 2004.
5 // Copyright (C) 2004 David P. Culp - davidculp2@comcast.net
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <simgear/math/point3d.hxx>
26 #include <Main/fg_props.hxx>
27 #include <Main/globals.hxx>
28 #include <Scenery/scenery.hxx>
34 #include "AIStorm.hxx"
37 FGAIStorm::FGAIStorm(FGAIManager* mgr) {
39 _type_str = "thunderstorm";
44 FGAIStorm::~FGAIStorm() {
48 bool FGAIStorm::init() {
49 return FGAIBase::init();
52 void FGAIStorm::bind() {
56 void FGAIStorm::unbind() {
61 void FGAIStorm::update(double dt) {
68 void FGAIStorm::Run(double dt) {
72 double speed_north_deg_sec;
73 double speed_east_deg_sec;
75 // convert speed to degrees per second
76 speed_north_deg_sec = cos( hdg / SG_RADIANS_TO_DEGREES )
77 * speed * 1.686 / ft_per_deg_lat;
78 speed_east_deg_sec = sin( hdg / SG_RADIANS_TO_DEGREES )
79 * speed * 1.686 / ft_per_deg_lon;
82 pos.setlat( pos.lat() + speed_north_deg_sec * dt);
83 pos.setlon( pos.lon() + speed_east_deg_sec * dt);
85 //###########################//
86 // do calculations for radar //
87 //###########################//