search

Class myphysicslab.lab.model.CollisionAdvance

Provided By
All Implemented Interfaces

Handles collisions by backing up in time with binary search algorithm. For better performance uses collision time estimates and handles imminent collisions.

When a collision is encountered, #advance backs up to just before the time of collision, handles the collision, then continues to advance to the end of the time step. (This process can happen many times during a single call to advance). Uses a binary search algorithm to get to the time just before the collision. The DiffEqSolver is used to move the simulation forward in time.

Debugging with WayPoints

CollisonAdvance can be very tricky to debug because the set of Collisions found drive the process, yet they come and go as we move backward and forward in time. Specifying WayPoints lets you focus on only the relevant aspects of the process, greatly reducing the volume of debug messages to sort thru.

A WayPoint is a step of the AdvanceStrategy process where debug info can be printed. See the methods #addWayPoints, #setWayPoints. The method #setDebugLevel selects a pre-defined group of WayPoints.

See Observing The Collision Handling Process in 2D Physics Engine Overview, and CollisionAdvance.DebugLevel.

new CollisionAdvance( sim, opt_diffEqSolver )

Parameters
simmyphysicslab.lab.model.CollisionSim

the CollisionSim to advance in time

opt_diffEqSolver(myphysicslab.lab.model.DiffEqSolver|undefined)

the DiffEqSolver to use, default is RungeKutta

Instance Methods

Enumerations