# NewGamePhysics.GraphicalElements.DoubleRegularPendulum Class Reference

Animated and drawable double pendulum. More...

Inheritance diagram for NewGamePhysics.GraphicalElements.DoubleRegularPendulum:

List of all members.

## Public Member Functions
| DoubleRegularPendulum (ScreenManager screenManager, Vector2 simulationOrigin, double l1, double m1, double l2, double m2, double g, RotationalFrictionType f, Vector2 screenOrigin, double screenScale)
| Constructor for animated double pendulum.
void | Draw (GameTime gameTime)
| Draw the double pendulum.
## Properties
DoubleRegularPendulumSimulation | Pendulum`[get]`
| Gets the pendulum simulation.

## Detailed Description

Animated and drawable double pendulum.

Definition at line 24 of file DoubleRegularPendulum.cs.

## Constructor & Destructor Documentation

NewGamePhysics.GraphicalElements.DoubleRegularPendulum.DoubleRegularPendulum | ( | ScreenManager | screenManager,
|  | Vector2 | simulationOrigin,
|  | double | l1,
|  | double | m1,
|  | double | l2,
|  | double | m2,
|  | double | g,
|  | RotationalFrictionType | f,
|  | Vector2 | screenOrigin,
|  | double | screenScale |
| ) |  |  |

Constructor for animated double pendulum.

Parameters:

  | screenManager | The screen manager to use for drawing.
  | simulationOrigin | The origin for pendulum in simulation space.
  | l1 | Length of the first rod in simulation space.
  | m1 | Mass of the first pendulum component.
  | l2 | Length of the second rod in simulation space.
  | m2 | Mass of the second pendulum component
  | g | The gravitational acceleration to apply.
  | f | The frictional model to use for the hinges.
  | screenOrigin | The origin for mapping simulation space to the screen.
  | screenScale | The scale for mapping simulation space to the screen.

Definition at line 59 of file DoubleRegularPendulum.cs.

    00070             : base(screenManager)
    00071         {
    00072             // Create pendulum simulation
    00073             this.pendulum = new DoubleRegularPendulumSimulation(simulationOrigin, l1, m1, l2, m2, g, f);
    00074             this.screenOrigin = screenOrigin;
    00075             this.screenScale = screenScale;
    00076
    00077             // Prepare texture
    00078             if (this.ScreenManager.Textures.ContainsKey("rivet"))
    00079             {
    00080                 rivetTexture = this.ScreenManager.Textures["rivet"];
    00081             }
    00082         }

## Member Function Documentation

void NewGamePhysics.GraphicalElements.DoubleRegularPendulum.Draw | ( | GameTime | gameTime | ) |

Draw the double pendulum.

Parameters:

  | gameTime | Current game time.
  | pendulum | The pendulum object.

Definition at line 97 of file DoubleRegularPendulum.cs.

    00098         {
    00099             // Draw Pendulum
    00100             Vector2[] pendulumPoints = this.pendulum.GetPosition(this.screenOrigin, this.screenScale);
    00101             this.PrimitiveBatch.Begin(PrimitiveType.LineList);
    00102             this.PrimitiveBatch.AddVertex(pendulumPoints[0], Color.White);
    00103             this.PrimitiveBatch.AddVertex(pendulumPoints[1], Color.White);
    00104             this.PrimitiveBatch.AddVertex(pendulumPoints[1], Color.White);
    00105             this.PrimitiveBatch.AddVertex(pendulumPoints[2], Color.White);
    00106             this.PrimitiveBatch.End();
    00107
    00108             // Check if we have the texture
    00109             if (null != rivetTexture)
    00110             {
    00111                 // Rivets
    00112                 Rectangle dest = new Rectangle(0, 0, 8, 8);
    00113                 this.SpriteBatch.Begin(SpriteBlendMode.AlphaBlend);
    00114                 dest.X = Convert.ToInt32(Math.Round(pendulumPoints[0].X)) - 4;
    00115                 dest.Y = Convert.ToInt32(Math.Round(pendulumPoints[0].Y)) - 4;
    00116                 this.SpriteBatch.Draw(rivetTexture, dest, Color.White);
    00117                 dest.X = Convert.ToInt32(Math.Round(pendulumPoints[1].X)) - 8;
    00118                 dest.Y = Convert.ToInt32(Math.Round(pendulumPoints[1].Y)) - 8;
    00119                 dest.Width = 16;
    00120                 dest.Height = 16;
    00121                 this.SpriteBatch.Draw(rivetTexture, dest, Color.White);
    00122                 dest.X = Convert.ToInt32(Math.Round(pendulumPoints[2].X)) - 8;
    00123                 dest.Y = Convert.ToInt32(Math.Round(pendulumPoints[2].Y)) - 8;
    00124                 this.SpriteBatch.Draw(rivetTexture, dest, Color.White);
    00125                 this.SpriteBatch.End();
    00126             }
    00127         }

## Property Documentation

DoubleRegularPendulumSimulation NewGamePhysics.GraphicalElements.DoubleRegularPendulum.Pendulum`[get]`

Gets the pendulum simulation.

Definition at line 88 of file DoubleRegularPendulum.cs.

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

- C:/Users/Andreas Schiffler/Desktop/SVN/NewGamePhysics/NewGamePhysics/GraphicalElements/DoubleRegularPendulum.cs