Collision between an atom and a wall in MoleculeSim simulation.

Implements

Constructors

Properties

accuracy_: number = 0.005

the collision distance accuracy: how close we must be to the moment of collision in order to be able to handle it.

distance_: number = NaN

distance between objects; negative = penetration

impulse: number = NaN

amount of impulse applied during collision

targetGap_: number = 0.005

target gap size after collision search finishes

Methods

  • Whether close enough to the point when this Collision can be handled. The allowTiny parameter exists because of cases where a small distance collision cannot be backed-up in time to get near to the preferred target 'half gap' distance.

    Parameters

    • allowTiny: boolean

      regard as 'close enough' Collisions that have smaller distance than distance accuracy would normally allow

    Returns boolean

    true if close enough to the point when this Collision can be handled.

  • Returns size of impulse (change in momentum) that was applied to this Collision.

    Returns number

    size of impulse that was applied to this Collision, or NaN if no impulse applied.

  • Returns the relative normal velocity between the two collision points. Negative velocity means the objects are colliding, positive means they are separating.

    Returns number

    relative normal velocity between the two collision points, negative means colliding

  • Whether the distance is small enough that the objects are touching each other so that impulses can be transmitted.

    Returns boolean

    whether the objects are touching each other

  • Returns true if this Collision needs to be resolved, such as by applying an impulse to reverse the velocities of the objects. This remains true even after backing up in time.

    Returns boolean

    true if this Collision needs to be resolved

  • Mark this Collision as one that needs handling because it is has caused the collision engine to backup in time in order to resolve this Collision. This is useful because after backing up in time, a Collision may no longer report itself as isColliding.

    Parameters

    • needsHandling: boolean

      true if this Collision needs to be resolved

    Returns void

  • Updates the information in this Collision to reflect current position and velocity of bodies. This is used after backing up in time to the moment before the collision.

    Parameters

    • _time: number

      the current simulation time

    Returns void

Generated using TypeDoc