copyCorner method Null safety

void copyCorner(
  1. int cornerIndex,
  2. Vector3 corner
)

Store the corner with cornerIndex in corner.

Implementation

void copyCorner(int cornerIndex, Vector3 corner) {
  assert(cornerIndex >= 0 || cornerIndex < 8);

  corner.setFrom(_center);

  switch (cornerIndex) {
    case 0:
      corner
        ..addScaled(_axis0, -_halfExtents.x)
        ..addScaled(_axis1, -_halfExtents.y)
        ..addScaled(_axis2, -_halfExtents.z);
      break;
    case 1:
      corner
        ..addScaled(_axis0, -_halfExtents.x)
        ..addScaled(_axis1, -_halfExtents.y)
        ..addScaled(_axis2, _halfExtents.z);
      break;
    case 2:
      corner
        ..addScaled(_axis0, -_halfExtents.x)
        ..addScaled(_axis1, _halfExtents.y)
        ..addScaled(_axis2, -_halfExtents.z);
      break;
    case 3:
      corner
        ..addScaled(_axis0, -_halfExtents.x)
        ..addScaled(_axis1, _halfExtents.y)
        ..addScaled(_axis2, _halfExtents.z);
      break;
    case 4:
      corner
        ..addScaled(_axis0, _halfExtents.x)
        ..addScaled(_axis1, -_halfExtents.y)
        ..addScaled(_axis2, -_halfExtents.z);
      break;
    case 5:
      corner
        ..addScaled(_axis0, _halfExtents.x)
        ..addScaled(_axis1, -_halfExtents.y)
        ..addScaled(_axis2, _halfExtents.z);
      break;
    case 6:
      corner
        ..addScaled(_axis0, _halfExtents.x)
        ..addScaled(_axis1, _halfExtents.y)
        ..addScaled(_axis2, -_halfExtents.z);
      break;
    case 7:
      corner
        ..addScaled(_axis0, _halfExtents.x)
        ..addScaled(_axis1, _halfExtents.y)
        ..addScaled(_axis2, _halfExtents.z);
      break;
  }
}