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⃗).
Calculation | Implemented |
---|---|
V |
|
V_dq |
|
V_dqdq |
|
V_dqdqdq |
|
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.gravity
The gravity vector for this instance of gravity.
Gravity.opengl_draw()
Gravity
does not draw a visual representation.