Skip to content

Latest commit

 

History

History
70 lines (46 loc) · 1.76 KB

gravity.rst

File metadata and controls

70 lines (46 loc) · 1.76 KB

Gravity -- Basic Gravity

trep.potentials

(Inherits from Potential)

param system

An instance of System to add the gravity to.

type system

System

param gravity

The gravity vector

type gravity

Sequence of three Float

param name

A string that uniquely identifies the gravity.

Gravity implements a basic constant acceleration gravity (F = mg⃗).

Implemented Calculations
Calculation Implemented
V

Y

V_dq

Y

V_dqdq

Y

V_dqdqdq

Y

Examples

Adding gravity to a system is as easy as declaring an instance of Gravity:

>>> system = build_custom_system()
>>> trep.potentials.Gravity(system)
<Gravity 0.000000 0.000000 -9.800000>

The System saves a reference to the new Gravity, so we do not have to save a refence to prevent it from being garbage collected.

The default gravity points in the negative Z direction. We can specify a new gravity vector when we add the gravity. For example, we can make gravity point in the positive Y direction:

>>> system = build_custom_system()
>>> trep.potentials.Gravity(system, (0, 9.8, 0))
<Gravity 0.000000 9.800000 0.000000>

Gravity Objects

Gravity.gravity

The gravity vector for this instance of gravity.

Visualization

Gravity.opengl_draw()

Gravity does not draw a visual representation.