getTransform method

void getTransform(
  1. Transform xf,
  2. double beta
)

Get the interpolated transform at a specific time.

The result is placed in xf. beta should be the normalized time in 0,1.

Implementation

void getTransform(Transform xf, double beta) {
  // xf->p = (1.0f - beta) * c0 + beta * c;
  // float32 angle = (1.0f - beta) * a0 + beta * a;
  // xf->q.Set(angle);
  xf.p.x = (1.0 - beta) * c0.x + beta * c.x;
  xf.p.y = (1.0 - beta) * c0.y + beta * c.y;
  final angle = (1.0 - beta) * a0 + beta * a;
  xf.q.setAngle(angle);

  // Shift to origin
  // xf->p -= b2Mul(xf->q, localCenter);
  final q = xf.q;
  xf.p.x -= q.cos * localCenter.x - q.sin * localCenter.y;
  xf.p.y -= q.sin * localCenter.x + q.cos * localCenter.y;
}