1 // flight.hxx -- define shared flight model parameters
3 // Written by Curtis Olson, started May 1997.
5 // Copyright (C) 1997 Curtis L. Olson - http://www.flightgear.org/~curt
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
29 # error This library requires C++
35 `FGInterface::get_Longitude ()'
36 `FGInterface::get_Latitude ()'
37 `FGInterface::get_Altitude ()'
38 `FGInterface::get_Phi ()'
39 `FGInterface::get_Theta ()'
40 `FGInterface::get_Psi ()'
41 `FGInterface::get_V_equiv_kts ()'
43 `FGInterface::get_V_north ()'
44 `FGInterface::get_V_east ()'
45 `FGInterface::get_V_down ()'
47 `FGInterface::get_P_Body ()'
48 `FGInterface::get_Q_Body ()'
49 `FGInterface::get_R_Body ()'
51 `FGInterface::get_Gamma_vert_rad ()'
52 `FGInterface::get_Climb_Rate ()'
53 `FGInterface::get_Alpha ()'
54 `FGInterface::get_Beta ()'
56 `FGInterface::get_Runway_altitude ()'
58 `FGInterface::get_Lon_geocentric ()'
59 `FGInterface::get_Lat_geocentric ()'
60 `FGInterface::get_Sea_level_radius ()'
61 `FGInterface::get_Earth_position_angle ()'
63 `FGInterface::get_Latitude_dot()'
64 `FGInterface::get_Longitude_dot()'
65 `FGInterface::get_Radius_dot()'
67 `FGInterface::get_Dx_cg ()'
68 `FGInterface::get_Dy_cg ()'
69 `FGInterface::get_Dz_cg ()'
71 `FGInterface::get_Radius_to_vehicle ()'
82 #include <simgear/compiler.h>
83 #include <simgear/constants.h>
84 #include <simgear/structure/subsystem_mgr.hxx>
85 #include <simgear/props/tiedpropertylist.hxx>
86 #include <FDM/groundcache.hxx>
97 * A little helper class to update the track if
98 * the position has changed. In the constructor,
99 * create a copy of the current position and store
100 * references to the position object and the track
101 * variable to update.
102 * The destructor, called at TrackComputer's end of
103 * life/visibility, computes the track if the
104 * position has changed.
106 class TrackComputer {
108 inline TrackComputer( double & track, const SGGeod & position ) :
110 _position( position ),
111 _prevPosition( position ) {
114 inline ~TrackComputer() {
115 if( _prevPosition == _position ) return;
116 _track = SGGeodesy::courseDeg( _prevPosition, _position );
120 const SGGeod & _position;
121 const SGGeod _prevPosition;
124 // This is based heavily on LaRCsim/ls_generic.h
125 class FGInterface : public SGSubsystem {
129 // Has the init() method been called. This is used to delay
130 // initialization until scenery can be loaded and we know the true
134 // Have we bound to the property system
137 // periodic update management variable. This is a scheme to run
138 // the fdm with a fixed delta-t. We control how many iteration of
139 // the fdm to run with the fixed dt based on the elapsed time from
140 // the last update. This allows us to maintain sync with the real
141 // time clock, even though each frame could take a random amount
142 // of time. Since "dt" is unlikely to divide evenly into the
143 // elapse time, we keep track of the remainder and add it into the
144 // next elapsed time. This yields a small amount of temporal
145 // jitter ( < dt ) but in practice seems to work well.
147 // CG position w.r.t. ref. point
148 SGVec3d d_cg_rp_body_v;
151 SGVec3d v_dot_local_v;
152 SGVec3d v_dot_body_v;
154 SGVec3d a_pilot_body_v;
156 SGVec3d omega_dot_body_v;
160 SGVec3d v_local_rel_ground_v; // V rel w.r.t. earth surface
161 SGVec3d v_local_airmass_v; // velocity of airmass (steady winds)
162 SGVec3d v_wind_body_v; // Wind-relative velocities in body axis
164 SGVec3d omega_body_v; // Angular B rates
165 SGVec3d euler_rates_v;
166 SGVec3d geocentric_rates_v; // Geocentric linear velocities
169 SGGeod geodetic_position_v;
170 SGVec3d cartesian_position_v;
171 SGGeoc geocentric_position_v;
172 SGVec3d euler_angles_v;
174 // Normal Load Factor
178 double v_rel_wind, v_true_kts;
179 double v_ground_speed, v_equiv_kts;
180 double v_calibrated_kts;
182 // Miscellaneious Quantities
183 double alpha, beta; // in radians
184 double gamma_vert_rad; // Flight path angles
185 double density, mach_number;
186 double static_pressure, total_pressure;
187 double dynamic_pressure;
188 double static_temperature, total_temperature;
189 double sea_level_radius, earth_position_angle;
190 double runway_altitude;
191 double climb_rate; // in feet per second
196 simgear::TiedPropertyList _tiedProperties;
198 // the ground cache object itself.
199 FGGroundCache ground_cache;
201 void set_A_X_pilot(double x)
202 { _set_Accels_Pilot_Body(x, a_pilot_body_v[1], a_pilot_body_v[2]); }
204 void set_A_Y_pilot(double y)
205 { _set_Accels_Pilot_Body(a_pilot_body_v[0], y, a_pilot_body_v[2]); }
207 void set_A_Z_pilot(double z)
208 { _set_Accels_Pilot_Body(a_pilot_body_v[0], a_pilot_body_v[1], z); }
212 int _calc_multiloop (double dt);
216 // deliberately not virtual so that
217 // FGInterface constructor will call
222 void _updatePositionM(const SGVec3d& cartPos);
223 void _updatePositionFt(const SGVec3d& cartPos) {
224 _updatePositionM(SG_FEET_TO_METER*cartPos);
226 void _updatePosition(const SGGeod& geod);
227 void _updatePosition(const SGGeoc& geoc);
229 void _updateGeodeticPosition( double lat, double lon, double alt );
230 void _updateGeocentricPosition( double lat_geoc, double lon, double alt );
231 void _update_ground_elev_at_pos( void );
233 inline void _set_CG_Position( double dx, double dy, double dz ) {
234 d_cg_rp_body_v[0] = dx;
235 d_cg_rp_body_v[1] = dy;
236 d_cg_rp_body_v[2] = dz;
238 inline void _set_Accels_Local( double north, double east, double down ) {
239 v_dot_local_v[0] = north;
240 v_dot_local_v[1] = east;
241 v_dot_local_v[2] = down;
243 inline void _set_Accels_Body( double u, double v, double w ) {
248 inline void _set_Accels_CG_Body( double x, double y, double z ) {
253 inline void _set_Accels_Pilot_Body( double x, double y, double z ) {
254 a_pilot_body_v[0] = x;
255 a_pilot_body_v[1] = y;
256 a_pilot_body_v[2] = z;
258 inline void _set_Accels_CG_Body_N( double x, double y, double z ) {
263 void _set_Nlf(double n) { nlf=n; }
264 inline void _set_Velocities_Local( double north, double east, double down ){
265 v_local_v[0] = north;
269 inline void _set_Velocities_Ground(double north, double east, double down) {
270 v_local_rel_ground_v[0] = north;
271 v_local_rel_ground_v[1] = east;
272 v_local_rel_ground_v[2] = down;
274 inline void _set_Velocities_Local_Airmass( double north, double east,
277 v_local_airmass_v[0] = north;
278 v_local_airmass_v[1] = east;
279 v_local_airmass_v[2] = down;
281 inline void _set_Velocities_Wind_Body( double u, double v, double w) {
282 v_wind_body_v[0] = u;
283 v_wind_body_v[1] = v;
284 v_wind_body_v[2] = w;
286 inline void _set_V_rel_wind(double vt) { v_rel_wind = vt; }
287 inline void _set_V_ground_speed( double v) { v_ground_speed = v; }
288 inline void _set_V_equiv_kts( double kts ) { v_equiv_kts = kts; }
289 inline void _set_V_calibrated_kts( double kts ) { v_calibrated_kts = kts; }
290 inline void _set_Omega_Body( double p, double q, double r ) {
295 inline void _set_Euler_Rates( double phi, double theta, double psi ) {
296 euler_rates_v[0] = phi;
297 euler_rates_v[1] = theta;
298 euler_rates_v[2] = psi;
301 void set_Phi_dot_degps(double x)
303 euler_rates_v[0] = x * SG_DEGREES_TO_RADIANS;
306 void set_Theta_dot_degps(double x)
308 euler_rates_v[1] = x * SG_DEGREES_TO_RADIANS;
311 void set_Psi_dot_degps(double x)
313 euler_rates_v[2] = x * SG_DEGREES_TO_RADIANS;
316 inline void _set_Geocentric_Rates( double lat, double lon, double rad ) {
317 geocentric_rates_v[0] = lat;
318 geocentric_rates_v[1] = lon;
319 geocentric_rates_v[2] = rad;
321 inline void _set_Geocentric_Position( double lat, double lon, double rad ) {
322 geocentric_position_v.setLatitudeRad(lat);
323 geocentric_position_v.setLongitudeRad(lon);
324 geocentric_position_v.setRadiusFt(rad);
326 /* Don't call _set_L[at|ong]itude() directly, use _set_Geodetic_Position() instead.
327 These methods can't update the track.
329 inline void _set_Latitude(double lat) {
330 geodetic_position_v.setLatitudeRad(lat);
332 inline void _set_Longitude(double lon) {
333 geodetic_position_v.setLongitudeRad(lon);
336 inline void _set_Altitude(double altitude) {
337 geodetic_position_v.setElevationFt(altitude);
339 inline void _set_Altitude_AGL(double agl) {
342 inline void _set_Geodetic_Position( double lat, double lon ) {
343 _set_Geodetic_Position( lat, lon, geodetic_position_v.getElevationFt());
345 inline void _set_Geodetic_Position( double lat, double lon, double alt ) {
346 TrackComputer tracker( track, geodetic_position_v );
347 geodetic_position_v.setLatitudeRad(lat);
348 geodetic_position_v.setLongitudeRad(lon);
349 geodetic_position_v.setElevationFt(alt);
351 inline void _set_Euler_Angles( double phi, double theta, double psi ) {
352 euler_angles_v[0] = phi;
353 euler_angles_v[1] = theta;
354 euler_angles_v[2] = psi;
356 // FIXME, for compatibility with JSBSim
357 inline void _set_T_Local_to_Body( int i, int j, double value) { }
358 inline void _set_Alpha( double a ) { alpha = a; }
359 inline void _set_Beta( double b ) { beta = b; }
361 inline void set_Alpha_deg( double a ) { alpha = a * SG_DEGREES_TO_RADIANS; }
363 inline void _set_Gamma_vert_rad( double gv ) { gamma_vert_rad = gv; }
364 inline void _set_Density( double d ) { density = d; }
365 inline void _set_Mach_number( double m ) { mach_number = m; }
366 inline void _set_Static_pressure( double sp ) { static_pressure = sp; }
367 inline void _set_Static_temperature( double t ) { static_temperature = t; }
368 inline void _set_Total_temperature( double tat ) { total_temperature = tat; } //JW
369 inline void _set_Sea_level_radius( double r ) { sea_level_radius = r; }
370 inline void _set_Earth_position_angle(double a) { earth_position_angle = a; }
371 inline void _set_Runway_altitude( double alt ) { runway_altitude = alt; }
372 inline void _set_Climb_Rate(double rate) { climb_rate = rate; }
377 FGInterface( double dt );
378 virtual ~FGInterface();
380 virtual void init ();
381 virtual void bind ();
382 virtual void unbind ();
383 virtual void update(double dt);
384 virtual bool ToggleDataLogging(bool state) { return false; }
385 virtual bool ToggleDataLogging(void) { return false; }
387 // Define the various supported flight models (many not yet implemented)
392 // The NASA LaRCsim (Navion) flight model
395 // Jon S. Berndt's new FDM written from the ground up in C++
398 // Christian's hot air balloon simulation
401 // Aeronautical DEvelopment AGEncy, Bangalore India
404 // The following aren't implemented but are here to spark
405 // thoughts and discussions, and maybe even action.
412 // Driven externally via a serial port, net, file, etc.
417 inline bool get_inited() const { return inited; }
418 inline void set_inited( bool value ) { inited = value; }
420 inline bool get_bound() const { return bound; }
422 //perform initializion that is common to all FDM's
426 virtual void set_Latitude(double lat); // geocentric
427 virtual void set_Longitude(double lon);
428 virtual void set_Altitude(double alt); // triggers re-calc of AGL altitude
429 virtual void set_AltitudeAGL(double altagl); // and vice-versa
430 virtual void set_Latitude_deg (double lat) {
431 set_Latitude(lat * SGD_DEGREES_TO_RADIANS);
433 virtual void set_Longitude_deg (double lon) {
434 set_Longitude(lon * SGD_DEGREES_TO_RADIANS);
437 // Speeds -- setting any of these will trigger a re-calc of the rest
438 virtual void set_V_calibrated_kts(double vc);
439 virtual void set_Mach_number(double mach);
440 virtual void set_Velocities_Local( double north, double east, double down );
441 inline void set_V_north (double north) {
442 set_Velocities_Local(north, v_local_v[1], v_local_v[2]);
444 inline void set_V_east (double east) {
445 set_Velocities_Local(v_local_v[0], east, v_local_v[2]);
447 inline void set_V_down (double down) {
448 set_Velocities_Local(v_local_v[0], v_local_v[1], down);
450 virtual void set_Velocities_Wind_Body( double u, double v, double w);
451 virtual void set_uBody (double uBody) {
452 set_Velocities_Wind_Body(uBody, v_wind_body_v[1], v_wind_body_v[2]);
454 virtual void set_vBody (double vBody) {
455 set_Velocities_Wind_Body(v_wind_body_v[0], vBody, v_wind_body_v[2]);
457 virtual void set_wBody (double wBody) {
458 set_Velocities_Wind_Body(v_wind_body_v[0], v_wind_body_v[1], wBody);
462 virtual void set_Euler_Angles( double phi, double theta, double psi );
463 virtual void set_Phi (double phi) {
464 set_Euler_Angles(phi, get_Theta(), get_Psi());
466 virtual void set_Theta (double theta) {
467 set_Euler_Angles(get_Phi(), theta, get_Psi());
469 virtual void set_Psi (double psi) {
470 set_Euler_Angles(get_Phi(), get_Theta(), psi);
472 virtual void set_Phi_deg (double phi) {
473 set_Phi(phi * SGD_DEGREES_TO_RADIANS);
475 virtual void set_Theta_deg (double theta) {
476 set_Theta(theta * SGD_DEGREES_TO_RADIANS);
478 virtual void set_Psi_deg (double psi) {
479 set_Psi(psi * SGD_DEGREES_TO_RADIANS);
483 virtual void set_Climb_Rate( double roc);
484 virtual void set_Gamma_vert_rad( double gamma);
488 virtual void set_Static_pressure(double p);
489 virtual void set_Static_temperature(double T);
490 virtual void set_Density(double rho);
492 virtual void set_Velocities_Local_Airmass (double wnorth,
496 // ========== Mass properties and geometry values ==========
498 // CG position w.r.t. ref. point
499 inline double get_Dx_cg() const { return d_cg_rp_body_v[0]; }
500 inline double get_Dy_cg() const { return d_cg_rp_body_v[1]; }
501 inline double get_Dz_cg() const { return d_cg_rp_body_v[2]; }
503 // ========== Accelerations ==========
505 inline double get_V_dot_north() const { return v_dot_local_v[0]; }
506 inline double get_V_dot_east() const { return v_dot_local_v[1]; }
507 inline double get_V_dot_down() const { return v_dot_local_v[2]; }
509 inline double get_U_dot_body() const { return v_dot_body_v[0]; }
510 inline double get_V_dot_body() const { return v_dot_body_v[1]; }
511 inline double get_W_dot_body() const { return v_dot_body_v[2]; }
513 inline double get_A_X_cg() const { return a_cg_body_v[0]; }
514 inline double get_A_Y_cg() const { return a_cg_body_v[1]; }
515 inline double get_A_Z_cg() const { return a_cg_body_v[2]; }
517 inline double get_A_X_pilot() const { return a_pilot_body_v[0]; }
518 inline double get_A_Y_pilot() const { return a_pilot_body_v[1]; }
519 inline double get_A_Z_pilot() const { return a_pilot_body_v[2]; }
521 inline double get_N_X_cg() const { return n_cg_body_v[0]; }
522 inline double get_N_Y_cg() const { return n_cg_body_v[1]; }
523 inline double get_N_Z_cg() const { return n_cg_body_v[2]; }
525 inline double get_Nlf(void) const { return nlf; }
527 // ========== Velocities ==========
529 inline double get_V_north() const { return v_local_v[0]; }
530 inline double get_V_east() const { return v_local_v[1]; }
531 inline double get_V_down() const { return v_local_v[2]; }
532 inline double get_uBody () const { return v_wind_body_v[0]; }
533 inline double get_vBody () const { return v_wind_body_v[1]; }
534 inline double get_wBody () const { return v_wind_body_v[2]; }
536 // Please dont comment these out. fdm=ada uses these (see
538 inline double get_V_north_rel_ground() const {
539 return v_local_rel_ground_v[0];
541 inline double get_V_east_rel_ground() const {
542 return v_local_rel_ground_v[1];
544 inline double get_V_down_rel_ground() const {
545 return v_local_rel_ground_v[2];
547 // <--- fdm=ada uses these (see cockpit.cxx)
549 inline double get_V_north_airmass() const { return v_local_airmass_v[0]; }
550 inline double get_V_east_airmass() const { return v_local_airmass_v[1]; }
551 inline double get_V_down_airmass() const { return v_local_airmass_v[2]; }
553 inline double get_U_body() const { return v_wind_body_v[0]; }
554 inline double get_V_body() const { return v_wind_body_v[1]; }
555 inline double get_W_body() const { return v_wind_body_v[2]; }
557 inline double get_V_rel_wind() const { return v_rel_wind; }
559 inline double get_V_true_kts() const { return v_true_kts; }
561 inline double get_V_ground_speed() const { return v_ground_speed; }
562 inline double get_V_ground_speed_kt() const { return v_ground_speed * SG_FEET_TO_METER * 3600 * SG_METER_TO_NM; }
563 inline void set_V_ground_speed_kt(double ground_speed) { v_ground_speed = ground_speed / ( SG_FEET_TO_METER * 3600 * SG_METER_TO_NM); }
565 inline double get_V_equiv_kts() const { return v_equiv_kts; }
567 inline double get_V_calibrated_kts() const { return v_calibrated_kts; }
569 inline double get_P_body() const { return omega_body_v[0]; }
570 inline double get_Q_body() const { return omega_body_v[1]; }
571 inline double get_R_body() const { return omega_body_v[2]; }
573 inline double get_Phi_dot() const { return euler_rates_v[0]; }
574 inline double get_Theta_dot() const { return euler_rates_v[1]; }
575 inline double get_Psi_dot() const { return euler_rates_v[2]; }
576 inline double get_Phi_dot_degps() const { return euler_rates_v[0] * SGD_RADIANS_TO_DEGREES; }
577 inline double get_Theta_dot_degps() const { return euler_rates_v[1] * SGD_RADIANS_TO_DEGREES; }
578 inline double get_Psi_dot_degps() const { return euler_rates_v[2] * SGD_RADIANS_TO_DEGREES; }
580 inline double get_Latitude_dot() const { return geocentric_rates_v[0]; }
581 inline double get_Longitude_dot() const { return geocentric_rates_v[1]; }
582 inline double get_Radius_dot() const { return geocentric_rates_v[2]; }
584 // ========== Positions ==========
586 inline double get_Lat_geocentric() const {
587 return geocentric_position_v.getLatitudeRad();
589 inline double get_Lon_geocentric() const {
590 return geocentric_position_v.getLongitudeRad();
592 inline double get_Radius_to_vehicle() const {
593 return geocentric_position_v.getRadiusFt();
596 const SGGeod& getPosition() const { return geodetic_position_v; }
597 const SGGeoc& getGeocPosition() const { return geocentric_position_v; }
598 const SGVec3d& getCartPosition() const { return cartesian_position_v; }
600 inline double get_Latitude() const {
601 return geodetic_position_v.getLatitudeRad();
603 inline double get_Longitude() const {
604 return geodetic_position_v.getLongitudeRad();
606 inline double get_Altitude() const {
607 return geodetic_position_v.getElevationFt();
609 inline double get_Altitude_AGL(void) const { return altitude_agl; }
610 inline double get_Track(void) const { return track; }
612 inline double get_Latitude_deg () const {
613 return geodetic_position_v.getLatitudeDeg();
615 inline double get_Longitude_deg () const {
616 return geodetic_position_v.getLongitudeDeg();
619 inline double get_Phi() const { return euler_angles_v[0]; }
620 inline double get_Theta() const { return euler_angles_v[1]; }
621 inline double get_Psi() const { return euler_angles_v[2]; }
622 inline double get_Phi_deg () const { return get_Phi() * SGD_RADIANS_TO_DEGREES; }
623 inline double get_Theta_deg () const { return get_Theta() * SGD_RADIANS_TO_DEGREES; }
624 inline double get_Psi_deg () const { return get_Psi() * SGD_RADIANS_TO_DEGREES; }
627 // ========== Miscellaneous quantities ==========
629 inline double get_Alpha() const { return alpha; }
630 inline double get_Alpha_deg() const { return alpha * SGD_RADIANS_TO_DEGREES; }
631 inline double get_Beta() const { return beta; }
632 inline double get_Beta_deg() const { return beta * SGD_RADIANS_TO_DEGREES; }
633 inline double get_Gamma_vert_rad() const { return gamma_vert_rad; }
635 inline double get_Density() const { return density; }
636 inline double get_Mach_number() const { return mach_number; }
638 inline double get_Static_pressure() const { return static_pressure; }
639 inline double get_Total_pressure() const { return total_pressure; }
640 inline double get_Dynamic_pressure() const { return dynamic_pressure; }
642 inline double get_Static_temperature() const { return static_temperature; }
643 inline double get_Total_temperature() const { return total_temperature; }
645 inline double get_Sea_level_radius() const { return sea_level_radius; }
646 inline double get_Earth_position_angle() const {
647 return earth_position_angle;
650 inline double get_Runway_altitude() const { return runway_altitude; }
651 inline double get_Runway_altitude_m() const { return SG_FEET_TO_METER * runway_altitude; }
653 inline double get_Climb_Rate() const { return climb_rate; }
655 // Note that currently this is the "same" value runway altitude...
656 inline double get_ground_elev_ft() const { return runway_altitude; }
659 //////////////////////////////////////////////////////////////////////////
660 // Ground handling routines
661 //////////////////////////////////////////////////////////////////////////
663 // Prepare the ground cache for the wgs84 position pt_*.
664 // That is take all vertices in the ball with radius rad around the
665 // position given by the pt_* and store them in a local scene graph.
666 bool prepare_ground_cache_m(double startSimTime, double endSimTime,
667 const double pt[3], double rad);
668 bool prepare_ground_cache_ft(double startSimTime, double endSimTime,
669 const double pt[3], double rad);
672 // Returns true if the cache is valid.
673 // Also the reference time, point and radius values where the cache
674 // is valid for are returned.
675 bool is_valid_m(double *ref_time, double pt[3], double *rad);
676 bool is_valid_ft(double *ref_time, double pt[3], double *rad);
678 // Return the nearest catapult to the given point
679 // pt in wgs84 coordinates.
680 double get_cat_m(double t, const double pt[3],
681 double end[2][3], double vel[2][3]);
682 double get_cat_ft(double t, const double pt[3],
683 double end[2][3], double vel[2][3]);
686 // Return the orientation and position matrix and the linear and angular
687 // velocity of that local coordinate systems origin for a given time and
688 // body id. The velocities are in the wgs84 frame at the bodys origin.
689 bool get_body_m(double t, simgear::BVHNode::Id id, double bodyToWorld[16],
690 double linearVel[3], double angularVel[3]);
693 // Return the altitude above ground below the wgs84 point pt
694 // Search for the nearest triangle to pt in downward direction.
695 // Return ground properties. The velocities are in the wgs84 frame at the
697 bool get_agl_m(double t, const double pt[3], double max_altoff,
698 double contact[3], double normal[3], double linearVel[3],
699 double angularVel[3], simgear::BVHMaterial const*& material,
700 simgear::BVHNode::Id& id);
701 bool get_agl_ft(double t, const double pt[3], double max_altoff,
702 double contact[3], double normal[3], double linearVel[3],
703 double angularVel[3], simgear::BVHMaterial const*& material,
704 simgear::BVHNode::Id& id);
705 double get_groundlevel_m(double lat, double lon, double alt);
706 double get_groundlevel_m(const SGGeod& geod);
709 // Return the nearest point in any direction to the point pt with a maximum
710 // distance maxDist. The velocities are in the wgs84 frame at the query
712 bool get_nearest_m(double t, const double pt[3], double maxDist,
713 double contact[3], double normal[3], double linearVel[3],
714 double angularVel[3], simgear::BVHMaterial const*& material,
715 simgear::BVHNode::Id& id);
716 bool get_nearest_ft(double t, const double pt[3], double maxDist,
717 double contact[3], double normal[3],double linearVel[3],
718 double angularVel[3], simgear::BVHMaterial const*& material,
719 simgear::BVHNode::Id& id);
722 // Return 1 if the hook intersects with a wire.
723 // That test is done by checking if the quad spanned by the points pt*
724 // intersects with the line representing the wire.
725 // If the wire is caught, the cache will trace this wires endpoints until
726 // the FDM calls release_wire().
727 bool caught_wire_m(double t, const double pt[4][3]);
728 bool caught_wire_ft(double t, const double pt[4][3]);
730 // Return the location and speed of the wire endpoints.
731 bool get_wire_ends_m(double t, double end[2][3], double vel[2][3]);
732 bool get_wire_ends_ft(double t, double end[2][3], double vel[2][3]);
734 // Tell the cache code that it does no longer need to care for
735 // the wire end position.
736 void release_wire(void);
739 #endif // _FLIGHT_HXX