# NewGamePhysics.Physics.RotationalFrictionModel Class Reference

Model that simulates friction on a hinge (i.e. rotational friction) by reducing the angular velocity during the integration step. More...

List of all members.

## Public Member Functions
| RotationalFrictionModel ()
| Create a friction model object and initialie the type to 'None'.
| RotationalFrictionModel (RotationalFrictionType f)
| Create a friction model object and initialie to the given type with some default parameters.
void | SetNone ()
| Set the None friction type.
void | SetLinear (double linearFrictionCoefficient)
| Set the Linear friction type.
void | SetStribeck (double stribeckStaticFriction, double stribeckFrictionScale)
| Set the Stribeck friction type.
double | ApplyFriction (double omega)
| Apply friction to a rotational element by changing the rotational speed.
## Properties
double | LinearFrictionCoefficient`[get]`
| Gets the linear friction coefficient for the linear friction model.
double | StribeckStaticFriction`[get]`
| Gets the static friction coefficient for the Stribeck friction model.
double | StribeckFrictionScale`[get]`
| Gets the scale coefficient for the Stribeck friction model.

## Detailed Description

Model that simulates friction on a hinge (i.e. rotational friction) by reducing the angular velocity during the integration step.

Definition at line 38 of file FrictionModel.cs.

## Constructor & Destructor Documentation

NewGamePhysics.Physics.RotationalFrictionModel.RotationalFrictionModel | ( |  | ) |

Create a friction model object and initialie the type to 'None'.

Definition at line 92 of file FrictionModel.cs.

    00093         {
    00094             this.frictionType = RotationalFrictionType.None;
    00095         }

NewGamePhysics.Physics.RotationalFrictionModel.RotationalFrictionModel | ( | RotationalFrictionType | f | ) |

Create a friction model object and initialie to the given type with some default parameters.

Definition at line 101 of file FrictionModel.cs.

    00102         {
    00103             this.frictionType = f;
    00104             switch (f)
    00105             {
    00106                 case RotationalFrictionType.Linear:
    00107                     this.linearFrictionCoefficient = 0.0005;
    00108                     break;
    00109                 case RotationalFrictionType.Stribeck:
    00110                     this.stribeckStaticFriction = 0.0001;
    00111                     this.stribeckFrictionScale = 0.0002;
    00112                     break;
    00113             }
    00114         }

## Member Function Documentation

double NewGamePhysics.Physics.RotationalFrictionModel.ApplyFriction | ( | double | omega | ) |

Apply friction to a rotational element by changing the rotational speed.

Parameters:

  | omega | Angular velocity without friction applied.

Returns:
  Angular velocity after friction was applied.

Definition at line 150 of file FrictionModel.cs.

    00151         {
    00152             // Friction difference
    00153             double deltaOmega = 0.0;
    00154             double o = Math.Abs(omega);
    00155
    00156             // Adjust by type
    00157             switch (this.frictionType)
    00158             {
    00159                 case RotationalFrictionType.None:
    00160                     // No friction
    00161                     deltaOmega = 0.0;
    00162                     break;
    00163                 case RotationalFrictionType.Linear:
    00164                     // Linear friction
    00165                     deltaOmega = linearFrictionCoefficient * o;
    00166                     break;
    00167                 case RotationalFrictionType.Stribeck:
    00168                     // Stribeck friction
    00169                     if (o < stribeckStaticFriction)
    00170                     {
    00171                         // Hinge stuck
    00172                         return 0.0;
    00173                     }
    00174                     else
    00175                     {
    00176                         // Calculate friction as curve
    00177                         deltaOmega = stribeckFrictionScale * (o - Math.Exp(-Math.Pow((o / 0.025), 0.3)) + Math.Pow(2.0 * o, (1 - 0.3)));
    00178                     }
    00179                     break;
    00180             }
    00181
    00182             // Handle discontinuity around zero
    00183             if (omega > 0.0)
    00184             {
    00185                 omega -= deltaOmega;
    00186                 if (omega < 0.0)
    00187                 {
    00188                     omega = 0.0;
    00189                 }
    00190             }
    00191             else
    00192             {
    00193                 omega += deltaOmega;
    00194                 if (omega > 0.0)
    00195                 {
    00196                     omega = 0.0;
    00197                 }
    00198             }
    00199
    00200             return omega;
    00201         }

void NewGamePhysics.Physics.RotationalFrictionModel.SetLinear | ( | double | linearFrictionCoefficient | ) |

Set the Linear friction type.

Definition at line 127 of file FrictionModel.cs.

    00128         {
    00129             this.frictionType = RotationalFrictionType.Linear;
    00130             this.linearFrictionCoefficient = linearFrictionCoefficient;
    00131         }

void NewGamePhysics.Physics.RotationalFrictionModel.SetNone | ( |  | ) |

Set the None friction type.

Definition at line 119 of file FrictionModel.cs.

    00120         {
    00121             this.frictionType = RotationalFrictionType.None;
    00122         }

void NewGamePhysics.Physics.RotationalFrictionModel.SetStribeck | ( | double | stribeckStaticFriction,
|  | double | stribeckFrictionScale |
| ) |  |  |

Set the Stribeck friction type.

Parameters:

  | stribeckStaticFriction | The Stribeck static friction coefficient.
  | stribeckFrictionScale | The Stribeck friction scale.

Definition at line 138 of file FrictionModel.cs.

    00139         {
    00140             this.frictionType = RotationalFrictionType.Stribeck;
    00141             this.stribeckStaticFriction = stribeckStaticFriction;
    00142             this.stribeckFrictionScale = stribeckFrictionScale;
    00143         }

## Property Documentation

double NewGamePhysics.Physics.RotationalFrictionModel.LinearFrictionCoefficient`[get]`

Gets the linear friction coefficient for the linear friction model.

Definition at line 66 of file FrictionModel.cs.

double NewGamePhysics.Physics.RotationalFrictionModel.StribeckFrictionScale`[get]`

Gets the scale coefficient for the Stribeck friction model.

Definition at line 84 of file FrictionModel.cs.

double NewGamePhysics.Physics.RotationalFrictionModel.StribeckStaticFriction`[get]`

Gets the static friction coefficient for the Stribeck friction model.

Definition at line 75 of file FrictionModel.cs.

The documentation for this class was generated from the following file:

- C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/Physics/FrictionModel.cs