Class: Field

Grape2D. Field

new Field(options)

A field exerts forces onto a particle. It can attract or pull away particles, according to it's mass.
Parameters:
Name Type Description
options Object Setup options.
Properties
Name Type Description
mass number Mass of the field.
position Grape2D.Vector Position of the field.
Source:

Members

<private> mass :number

Mass of the field.
Type:
  • number
Source:

<private> position :Grape2D.Vector

Position of the field.
Type:
Source:

Methods

<private> computeAcceleration(position) → {Grape2D.Vector}

Computes the acceleration that this field makes in a point.
Parameters:
Name Type Description
position Grape2D.Vector Position to calculate the force.
Source:
Returns:
Acceleration at a point.
Type
Grape2D.Vector

getMass() → {number}

Gets the mass of the field.
Source:
Returns:
Mass of the field.
Type
number

getPosition() → {Grape2D.Vector}

Gets the position of the field.
Source:
Returns:
Position of the field.
Type
Grape2D.Vector

setMass(mass)

Sets the mass of the field.
Parameters:
Name Type Description
mass number Mass of the field.
Source:

setPosition(position)

Sets the position of the field.
Parameters:
Name Type Description
position Grape2D.Vector Position of the field.
Source: