lib/Manifold.js
function getPointStates(state1, state2, manifold1, manifold2) {
  // for (var i = 0; i < Settings.maxManifoldPoints; ++i) {
  // state1[i] = PointState.nullState;
  // state2[i] = PointState.nullState;
  // }

  // Detect persists and removes.
  for (var i = 0; i < manifold1.pointCount; ++i) {
    var id = manifold1.points[i].id;// ContactID

    state1[i] = PointState.removeState;

    for (var j = 0; j < manifold2.pointCount; ++j) {
      if (manifold2.points[j].id.key == id.key) {
        state1[i] = PointState.persistState;
        break;
      }
    }
  }

  // Detect persists and adds.
  for (var i = 0; i < manifold2.pointCount; ++i) {
    var id = manifold2.points[i].id;// ContactID

    state2[i] = PointState.addState;

    for (var j = 0; j < manifold1.pointCount; ++j) {
      if (manifold1.points[j].id.key == id.key) {
        state2[i] = PointState.persistState;
        break;
      }
    }
  }
}
function getPointStates(state1, state2, manifold1, manifold2) {
  // for (var i = 0; i < Settings.maxManifoldPoints; ++i) {
  // state1[i] = PointState.nullState;
  // state2[i] = PointState.nullState;
  // }

  // Detect persists and removes.
  for (var i = 0; i < manifold1.pointCount; ++i) {
    var id = manifold1.points[i].id;// ContactID

    state1[i] = PointState.removeState;

    for (var j = 0; j < manifold2.pointCount; ++j) {
      if (manifold2.points[j].id.key == id.key) {
        state1[i] = PointState.persistState;
        break;
      }
    }
  }

  // Detect persists and adds.
  for (var i = 0; i < manifold2.pointCount; ++i) {
    var id = manifold2.points[i].id;// ContactID

    state2[i] = PointState.addState;

    for (var j = 0; j < manifold1.pointCount; ++j) {
      if (manifold1.points[j].id.key == id.key) {
        state2[i] = PointState.persistState;
        break;
      }
    }
  }
}
function getPointStates ( state1 , state2 , manifold1 , manifold2 ) { // for (var i = 0; i < Settings.maxManifoldPoints; ++i) { // state1[i] = PointState.nullState; // state2[i] = PointState.nullState; // } // Detect persists and removes. for ( var i = 0 ; i < manifold1 . pointCount ; ++ i ) { var id = manifold1 . points [ i ] . id ; // ContactID state1 [ i ] = PointState . removeState ; for ( var j = 0 ; j < manifold2 . pointCount ; ++ j ) { if ( manifold2 . points [ j ] . id . key == id . key ) { state1 [ i ] = PointState . persistState ; break ; } } } // Detect persists and adds. for ( var i = 0 ; i < manifold2 . pointCount ; ++ i ) { var id = manifold2 . points [ i ] . id ; // ContactID state2 [ i ] = PointState . addState ; for ( var j = 0 ; j < manifold1 . pointCount ; ++ j ) { if ( manifold1 . points [ j ] . id . key == id . key ) { state2 [ i ] = PointState . persistState ; break ; } } } }
Compute the point states given two manifolds. The states pertain to the
transition from manifold1 to manifold2. So state1 is either persist or remove
while state2 is either add or persist.

@param {PointState[Settings.maxManifoldPoints]} state1
@param {PointState[Settings.maxManifoldPoints]} state2
Compute the point states given two manifolds . The states pertain to the transition from manifold1 to manifold2 . So state1 is either persist or remove while state2 is either add or persist .