41 #include "input_output/FGPropertyManager.h"
42 #include "models/FGSurface.h"
52 FGSurface::FGSurface(
FGFDMExec* fdmex,
int number) :
55 eSurfaceType = ctBOGEY;
72 maximumForce = DBL_MAX;
82 void FGSurface::bind(
void)
84 if (!_PropertyManager)
return;
86 string base_property_name;
89 switch(eSurfaceType) {
91 base_property_name = _CreateIndexedPropertyName(
"gear/unit", contactNumber);
94 base_property_name = _CreateIndexedPropertyName(
"contact/unit", contactNumber);
97 base_property_name =
"ground";
103 property_name = base_property_name +
"/solid";
104 _PropertyManager->
Tie( property_name.c_str(), &isSolid);
105 property_name = base_property_name +
"/bumpiness";
106 _PropertyManager->
Tie( property_name.c_str(), &bumpiness);
107 property_name = base_property_name +
"/maximum-force-lbs";
108 _PropertyManager->
Tie( property_name.c_str(), &maximumForce);
109 property_name = base_property_name +
"/rolling_friction-factor";
110 _PropertyManager->
Tie( property_name.c_str(), &rollingFFactor);
111 property_name = base_property_name +
"/static-friction-factor";
112 _PropertyManager->
Tie( property_name.c_str(), &staticFFactor);
119 if (bumpiness < 0.001)
return 0.0f;
121 double x = pos[0]*0.1;
122 double y = pos[1]*0.1;
132 static const float maxGroundBumpAmplitude=0.4;
133 float h = sin(x)+sin(7*x)+sin(8*x)+sin(13*x);
134 h += sin(2*y)+sin(5*y)+sin(9*y*x)+sin(17*y);
136 return h*(1/8.)*bumpiness*maxGroundBumpAmplitude;
141 string FGSurface::_CreateIndexedPropertyName(
const string& Property,
int index)
143 std::ostringstream buf;
144 buf << Property <<
'[' << index <<
']';
150 string FGSurface::GetSurfaceStrings(
string delimeter)
const
152 std::ostringstream buf;
154 buf <<
"staticFFactor" << delimeter
155 <<
"rollingFFactor" << delimeter
156 <<
"maximumForce" << delimeter
157 <<
"bumpiness" << delimeter
165 string FGSurface::GetSurfaceValues(
string delimeter)
const
167 std::ostringstream buf;
169 buf << staticFFactor << delimeter
170 << rollingFFactor << delimeter
171 << maximumForce << delimeter
172 << bumpiness << delimeter
173 << (isSolid ?
"1" :
"0");