withComponent method

Vector3 withComponent(
  1. int index,
  2. double value
)

Implementation

Vector3 withComponent(int index, double value) {
  if (index == 0) {
    return withCoords(x: value);
  } else if (index == 1) {
    return withCoords(y: value);
  } else if (index == 2) {
    return withCoords(z: value);
  } else {
    throw 'Cannot index a vector3 with index=$index';
  }
}