set method

void set(
  1. Body bi,
  2. Body bj,
  3. bool value
)

Set an element

Implementation

void set(Body bi, Body bj, bool value) {
  int i = bi.index;
  int j = bj.index;
  if (j > i) {
    final temp = j;
    j = i;
    i = temp;
  }

  matrix[((i * (i + 1) >> 1)) + j - 1] = value ? 1 : 0;
}