A simulation that applies a constant accelerating force.

Models a particle that follows Newton's second law of motion. The simulation ends when the position reaches a defined point.

Inheritance

Constructors

GravitySimulation(double acceleration, double distance, double endDistance, double velocity)

Creates a GravitySimulation using the given arguments, which are, respectively: an acceleration that is to be applied continually over time; an initial position relative to an origin; the magnitude of the distance from that origin beyond which (in either direction) to consider the simulation to be "done", which must be positive; and an initial velocity.

Properties

hashCode int

Get a hash code for this object.

read-only, inherited
runtimeType Type

A representation of the runtime type of the object.

read-only, inherited
tolerance Tolerance

How close to the actual end of the simulation a value at a particular time must be before isDone considers the simulation to be "done".

read / write, inherited

Operators

operator ==(other) bool

The equality operator.

inherited

Methods

dx(double time) double

The velocity of the object in the simulation at the given time.

isDone(double time) bool

Whether the simulation is "done" at the given time.

x(double time) double

The position of the object in the simulation at the given time.

noSuchMethod(Invocation invocation) → dynamic

Invoked when a non-existent method or property is accessed.

inherited
toString() String

Returns a string representation of this object.

inherited