- // Euler angles are built up to create a local frame to describe the forces
- // applied to the gear by the ground. Here pitch, yaw and roll do not have
- // any physical meaning. It is just a convenient notation.
- // First, "pitch" and "yaw" are determined in order to align eX with the
- // ground normal.
- if (vGroundNormal(eZ) < -1.0)
- vOrient(ePitch) = 0.5*M_PI;
- else if (1.0 < vGroundNormal(eZ))
- vOrient(ePitch) = -0.5*M_PI;
- else
- vOrient(ePitch) = asin(-vGroundNormal(eZ));
-
- if (fabs(vOrient(ePitch)) == 0.5*M_PI)
- vOrient(eYaw) = 0.;
- else
- vOrient(eYaw) = atan2(vGroundNormal(eY), vGroundNormal(eX));
-
- vOrient(eRoll) = 0.;
- UpdateCustomTransformMatrix();
-
- if (eContactType == ctBOGEY) {
- // In the case of a bogey, the third angle "roll" is used to align the axis eY and eZ
- // to the rolling and sliping direction respectively.
- FGColumnVector3 updatedRollingAxis = Transform().Transposed() * mTGear
- * FGColumnVector3(-sin(SteerAngle), cos(SteerAngle), 0.);
-
- vOrient(eRoll) = atan2(updatedRollingAxis(eY), -updatedRollingAxis(eZ));
- UpdateCustomTransformMatrix();
- }
-}
-
-//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-void FGLGear::ComputeRetractionState(void)
-{
- double gearPos = GetGearUnitPos();
- if (gearPos < 0.01) {
- GearUp = true;
- WOW = false;
- GearDown = false;
- vWhlVelVec.InitMatrix();
- } else if (gearPos > 0.99) {
- GearDown = true;
- GearUp = false;
- } else {
- GearUp = false;
- GearDown = false;
- }
+ FGColumnVector3 roll = mTGear * FGColumnVector3(cos(SteerAngle), sin(SteerAngle), 0.);
+ FGColumnVector3 side = vGroundNormal * roll;
+
+ roll -= DotProduct(roll, vGroundNormal) * vGroundNormal;
+ roll.Normalize();
+ side.Normalize();
+
+ mT(eX,eX) = roll(eX);
+ mT(eY,eX) = roll(eY);
+ mT(eZ,eX) = roll(eZ);
+ mT(eX,eY) = side(eX);
+ mT(eY,eY) = side(eY);
+ mT(eZ,eY) = side(eZ);
+ mT(eX,eZ) = vGroundNormal(eX);
+ mT(eY,eZ) = vGroundNormal(eY);
+ mT(eZ,eZ) = vGroundNormal(eZ);