initialize method

void initialize(
  1. A b1,
  2. B b2,
  3. Vector2 ga1,
  4. Vector2 ga2,
  5. Vector2 anchor1,
  6. Vector2 anchor2,
  7. double r,
)

Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.

Implementation

void initialize(
  A b1,
  B b2,
  Vector2 ga1,
  Vector2 ga2,
  Vector2 anchor1,
  Vector2 anchor2,
  double r,
) {
  bodyA = b1;
  bodyB = b2;
  groundAnchorA = ga1;
  groundAnchorB = ga2;
  localAnchorA.setFrom(bodyA.localPoint(anchor1));
  localAnchorB.setFrom(bodyB.localPoint(anchor2));
  final d1 = anchor1 - ga1;
  lengthA = d1.length;
  final d2 = anchor2 - ga2;
  lengthB = d2.length;
  ratio = r;
  assert(ratio > settings.epsilon);
}