rescaleToFit method

void rescaleToFit(
  1. double length,
  2. int dim, {
  3. bool stretch = false,
  4. Vector3 aboutEdge = ORIGIN,
  5. Vector3? aboutPoint,
})

Implementation

void rescaleToFit(double length, int dim,
    {bool stretch = false, Vector3 aboutEdge = ORIGIN, Vector3? aboutPoint}) {
  var oldLength = lengthOverDim(dim);

  if (oldLength == 0) {
    return;
  }

  if (stretch) {
    this.stretch(length / oldLength, dim,
        aboutEdge: aboutEdge, aboutPoint: aboutPoint);
  } else {
    scaleUniformly(length / oldLength,
        aboutEdge: aboutEdge, aboutPoint: aboutPoint);
  }
}