1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2 3 Header: FGSurface.h 4 Author: Erik Hofman 5 Date started: 01/15/14 6 7 ------------- Copyright (C) 2014 Jon S. Berndt (jon@jsbsim.org) ------------- 8 9 This program is free software; you can redistribute it and/or modify it under 10 the terms of the GNU Lesser General Public License as published by the Free Software 11 Foundation; either version 2 of the License, or (at your option) any later 12 version. 13 14 This program is distributed in the hope that it will be useful, but WITHOUT 15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 17 details. 18 19 You should have received a copy of the GNU Lesser General Public License along with 20 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 21 Place - Suite 330, Boston, MA 02111-1307, USA. 22 23 Further information about the GNU Lesser General Public License can also be found on 24 the world wide web at http://www.gnu.org. 25 26 HISTORY 27 -------------------------------------------------------------------------------- 28 01/15/14 EMH Created 29 30 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 31 SENTRY 32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 33 34 #ifndef FGSURFACE_H 35 #define FGSURFACE_H 36 37 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 38 INCLUDES 39 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 40 41 #include "FGFDMExec.h" 42 43 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 44 FORWARD DECLARATIONS 45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 46 47 namespace JSBSim { 48 49 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 50 CLASS DOCUMENTATION 51 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 52 53 /** Base class for all surface properties 54 @author Erik M. Hofman 55 */ 56 57 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 58 CLASS DECLARATION 59 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ 60 61 class FGSurface 62 { 63 public: 64 65 enum ContactType {ctBOGEY, ctSTRUCTURE, ctGROUND}; 66 67 /// Constructor 68 FGSurface(FGFDMExec* fdmex, int number = -1); 69 70 /// Destructor 71 ~FGSurface(); 72 73 void bind(void); 74 75 /// Reset all surface values to a default 76 void resetValues(void); 77 78 /// Sets the static friction factor of the surface area SetStaticFFactor(double friction)79 void SetStaticFFactor(double friction) { staticFFactor = friction; } 80 81 /// Sets the rolling friction factor of the surface area SetRollingFFactor(double friction)82 void SetRollingFFactor(double friction) { rollingFFactor = friction; } 83 84 /// Sets the maximum force for the surface area SetMaximumForce(double force)85 void SetMaximumForce(double force) { maximumForce = force; } 86 87 /// Sets the normalized bumpiness factor associated with the surface SetBumpiness(double bump)88 void SetBumpiness(double bump) { bumpiness = bump; } 89 90 /// Sets the surface is a solid flag value SetSolid(bool solid)91 void SetSolid(bool solid) { isSolid = solid; } 92 93 /// Set the currect position for bumpiness calulcation SetPosition(const double pt[3])94 void SetPosition(const double pt[3]) { 95 pos[0] = pt[0]; pos[1] = pt[1]; pos[2] = pt[2]; 96 } 97 98 99 /// Gets the static friction factor of the surface area GetStaticFFactor(void)100 double GetStaticFFactor(void) { return staticFFactor; } 101 102 /// Gets the rolling friction factor of the surface area GetRollingFFactor(void)103 double GetRollingFFactor(void) { return rollingFFactor; } 104 105 /// Gets the maximum force of the surface area GetMaximumForce(void)106 double GetMaximumForce(void) { return maximumForce; } 107 108 /// Gets the normalized bumpiness factor associated with the surface GetBumpiness(void)109 double GetBumpiness(void) { return bumpiness; } 110 111 /// Gets the surface is a solid flag value GetSolid(void)112 bool GetSolid(void) { return isSolid; } 113 114 /// Returns the height of the bump at the provided offset 115 float GetBumpHeight(); 116 117 std::string GetSurfaceStrings(std::string delimeter) const; 118 std::string GetSurfaceValues(std::string delimeter) const; 119 120 protected: 121 ContactType eSurfaceType; 122 double staticFFactor, rollingFFactor; 123 double maximumForce; 124 double bumpiness; 125 bool isSolid; 126 127 double staticFCoeff, dynamicFCoeff; 128 129 private: 130 int contactNumber; 131 double pos[3]; 132 133 FGPropertyManager* _PropertyManager; 134 135 static std::string _CreateIndexedPropertyName(const std::string& Property, int index); 136 }; 137 138 } 139 //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 140 #endif 141